On some forums, NaN instead of a number on badge pages

On some Discourse forums, for example Python and iNaturalist, NaN appears instead of a number on some pages related to badges.

See iNaturalist Forum: NaN instead of a number on badge pages.

5 Likes

I can see it here on Meta too. For example on https://meta.discourse.org/badges/114/bug-reporter?username=nat

I must be overlooking something

1 Like

I think I found it. It’s related to the changes in DEV: Replace deprecated Ember's array `.pushObjects` by megothss · Pull Request #35663 · discourse/discourse · GitHub. That change made userBadges an array, but othersCount still expects something with a grant_count value.

2 Likes

Thanks. Will the eventual fix require any subsequent action on the part of maintainers of individual Discourse forums, or will the fix propagate automatically to those forums?

Once the bug is fixed, the forum needs to be updated. On self-hosted forums, this is something the admin needs to do. iNaturalist is hosted by Discourse, so they take care of updates. This usually happens very regularly. Perhaps the person who fixes this will also make sure that the forum receives an update. However, I don’t know whether the bug is considered severe enough to warrant this.

1 Like

Yeah, quite likely nobody has been losing any sleep over this detail, but it seemed to me a good idea to report it in case it also affected other details on the forums.

1 Like

I also just noticed this right now, I was going to file a bug report but then I found this topic.

On forums that are not hosted by Discourse , the text is correct because something new with the code changed the badge page to NaN.

Forums that have not updated yet are not affected by this.

For example, the Dark Gaming forum uses Discourse v3.6.0.beta1-dev from this commit (3352cec1bb) and everything is correct.

Another edit: Admins of the site can work around this by modifying the texts js.badges.others_count.other and js.badges.others_count.one but this bug is going to be fixed relatively quickly.

1 Like

Edit:
Looks like there’s already a merge in flight. Meta should be updated with it soon.


This should fix the issue.
https://github.com/discourse/discourse/pull/35911

4 Likes

Thanks for the fix, Discourse Team.

1 Like

Thanks for the quick fix.

Would at least one @team member like the first post? I think Quercus deserves the badge.

5 Likes