30

... and it tells me that I need a negative number of reviews to get that badge.

Also reported by user Dharman in SOCVR: It looks like I can get a silver badge for review if I only review -2372 more

And here is one from SFF from Mithical:

Just to be clear, this is not a case of me tracking badges or missing badges for other queues. This is what my badge progress looks like for /review/low-quality-posts/stats here on MSE:

enter image description here

(sorry for not having done enough reviewing there)

There is no gold badge there.

Can this be fixed?

  • Do you have the badge for all queues? – Mast Jun 4 at 11:59
  • 4
    @Mast no, on SO I'm short of H&I and intend to keep it that way. – rene Jun 4 at 12:02
  • That may be part of the source of the issue. You both have it and are tracking it. A different one that you already have with the same name. That still shouldn't give negative numbers, but it may be a start. – Mast Jun 4 at 12:03
  • @Mast Hmm, I expect that page to show me badges for that review queue. Not all the other queues. I've added an extra screenshot for a queue here on MSE – rene Jun 4 at 12:05
  • Hmmm, yes, it gives me negative numbers on badges I already have on other sites too. – Mast Jun 4 at 12:32
  • Can reproduce on CR.SE/review/close/stats. – Mast Jun 4 at 12:35
  • 8
    Basically there's 2 bugs here. 1) It gives a negative number for badges already earnt where it shouldn't. 2) It doesn't show how many reviews are left for the next badge, which seems to be the purpose of that part of the overview. – Mast Jun 4 at 12:40
  • It seems fairly universal, I see it on Spanish.se too. – mdewey Jun 4 at 13:17
  • 2
    Apparently someone forgot to end a </p> so it just says </p. – Catija Jun 4 at 21:37
14

This is fixed. This bug was introduced through a typo in a dark mode fix PR.

The code looked like:

@if (earned) {
    <p>EARNED</p
} else {
    <p>UNEARNED</p>
}

The missed closure of the tag closure means </p } else { <p> was interpreted as a the tag closing by both the Razor parser the browser.

As a result, users who had earned the badge got the following rendered DOM:

<p>EARNED</p>
UNEARNED
<p></p>

As the reviewer of the PR, this one's on me. I feel like the reason both I and the author missed this was that it fails so subtly for users who haven't earned the silver or gold badges, omitting them rather than emitting incorrect HTML.

| improve this answer | |
  • 2
    Seems to me like the <p> and </p> tags should be factored out of the conditional, since they are "common". That would prevent this problem and others like it in the future. Limit your conditional code to only that which needs to be conditioned. – Cody Gray Jun 4 at 23:55
  • @CodyGray If you did that, you would have to think about accidentally adding spaces inside the <p>. Your output would basically be inline level instead of block level, so you would probably have to squeeze everything onto one line to make it clear. Also, you would lose any chance of adding additional classes based on the conditional. – Andrew Myers Jun 5 at 2:52
  • 1
    @CodyGray Razor syntax moves between C# and HTML based on the presence of tags, so there‚Äôs got to be some element inside the brackets or things get convoluted and brittle. – Brian Nickel Jun 5 at 6:42
  • I assume with us in a revision > 2020.6.4.36968 ? – rene Jun 5 at 6:43
  • 2
    @rene Yep, the fix is in now and looks correct for me on SO. – Brian Nickel Jun 5 at 16:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .