pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
226 stars 53 forks source link

'EventStat' object has no attribute 'webranking' #202

Closed Prof-Bloodstone closed 2 years ago

Prof-Bloodstone commented 2 years ago

Running latest script freshly without the data/ dir existing results in:

Traceback (most recent call last):
  File "<PATH>/update.py", line 489, in <module>
    event.webranking = sorted(event.webranking, key = lambda i: i['value'], reverse=True)
AttributeError: 'EventStat' object has no attribute 'webranking'

Looks like https://github.com/pdinklag/MinecraftStats/commit/2ae7aee2ec77c41ca79bb597b9944a3d249a1487 might have broken it, since EventStat only has ranking: https://github.com/pdinklag/MinecraftStats/commit/2ae7aee2ec77c41ca79bb597b9944a3d249a1487

I can confirm that running global replace s/webranking/ranking/g on the update script results in no errors from the script.

Let me know if I should PR this as fix :)

pdinklag commented 2 years ago

Running latest script freshly without the data/ dir existing results in:

Traceback (most recent call last):
  File "<PATH>/update.py", line 489, in <module>
    event.webranking = sorted(event.webranking, key = lambda i: i['value'], reverse=True)
AttributeError: 'EventStat' object has no attribute 'webranking'

That's not good, I'll have a look.

Looks like 2ae7aee might have broken it, since EventStat only has ranking: 2ae7aee

I can confirm that running global replace s/webranking/ranking/g on the update script results in no errors from the script.

That sounds like a bad idea, because that commit fixed the ranking display being one update behind all the time. This bug should be fixed properly, probably by initializing the webranking as empty when it doesn't exist.