PhlexPlexico / get5-web

[END OF LIFE] Webpanel for servers using the get5 CS:GO server plugin
GNU General Public License v3.0
21 stars 10 forks source link

[BUG] Statistics break after backup #134

Closed Fortage closed 5 years ago

Fortage commented 5 years ago

Describe the bug

Does not enter statistics after backup. Write on site
"Sorry, unexpected error: float division by zero"

Which Build Is this happening on master?

To Reproduce Steps to reproduce the behavior:

  1. After Start match need Make 2 backups on 1 match (after 1 backup's all worked good.). And now see this table http://cs.uralgamearea.ru/match/42 . And after this steps individual statistics crash. with "Sorry, unexpected error: float division by zero"

Expected behavior I expected normal write statistics.

PhlexPlexico commented 5 years ago

Can you please provide some more information? There is also a log file for get5 located in /logs/ that would be very helpful to see the additional errors, and where it's trying to calculate percentage. I assume it's going to be on HSP as I've had this problem before.

Fortage commented 5 years ago

No problem. get5.log

get5.log.2019-09-01.log

PhlexPlexico commented 5 years ago

Thank you! It seems to be a problem with ratings and I assume the backup and restore rounds may have set the roundsplayed to zero. I think it should be a simple fix to check that. I'll look more into it. Thanks!

PhlexPlexico commented 5 years ago

Oh yeah I see now. When trying to calculate the rating for that one match, it's looking at the one users' kills/deaths/rounds played. Since (by the looks of it) the backup nuked the rounds played, it's trying to divide 1 by 0, causing the error. A wrapper just needs to be put around the rating and just return zero if we divide by zero.

PhlexPlexico commented 5 years ago

Take a look at commit a992725. That should fix the bug and just zero out any ratings that cannot be calculated to zero.

Fortage commented 5 years ago

Yes, statistics show. But then I had a question, and the statistics that the player has accumulated in this match and which does not appear in the match list, does it miss?

PhlexPlexico commented 5 years ago

If a match is ever cancelled, not finalised, or forfeit, it should not include in the stats, since the match was never played. I wanted some of these stats to update in real-time, but I guess I forgot to include Match.cancelled == 1 in the query: https://github.com/PhlexPlexico/get5-web/blob/master/get5/leaderboard.py#L80

Will update this as well later today, good catch!

PhlexPlexico commented 5 years ago

Updated in development!

PhlexPlexico commented 5 years ago

Closing this as it has been resolved. If issue persists with this exact problem, feel free to re-open. If not, create another bug. Thanks! 🤙