trackobot.com
trackobot.com copied to clipboard
Arena stats being calculated incorrectly
cf. https://github.com/stevschmid/track-o-bot/issues/66
@stevschmid did you manage to reproduce the issue?
I experience a version of this bug where all averages are "0.0".

The "Runs" column is accurate, as well as the histogram in the bottom. I expected to see data in other columns, though.
This isn't a template issue, since the JSON representation of this endpoint also reports most numbers as "0":
{
"stats": {
"as_hero": {
"Druid": {
"losses": 0,
"runs": 6,
"total": 0,
"wins": 0
},
"Hunter": {
"losses": 0,
"total": 0,
"wins": 0
},
"Mage": {
"losses": 0,
"runs": 17,
"total": 0,
"wins": 0
},
"Paladin": {
"losses": 0,
"runs": 12,
"total": 0,
"wins": 0
},
"Priest": {
"losses": 0,
"runs": 1,
"total": 0,
"wins": 0
},
"Rogue": {
"losses": 0,
"runs": 13,
"total": 0,
"wins": 0
},
"Shaman": {
"losses": 0,
"runs": 3,
"total": 0,
"wins": 0
},
"Warlock": {
"losses": 0,
"runs": 6,
"total": 0,
"wins": 0
},
"Warrior": {
"losses": 0,
"runs": 2,
"total": 0,
"wins": 0
}
},
"count_by_wins": [
2,
8,
9,
8,
5,
5,
13,
3,
3,
0,
0,
1,
3
],
"overall": {
"losses": 0,
"runs": 60,
"total": 0,
"wins": 0
}
}
}
I couldn't reproduce locally in development. But, it's interesting that the numbers which are valid all come from user_arenas
scope, while all numbers that are zero come from user_results.arena
. I would presume that the user_results.arena
scope is somehow busted in production mode, although looking at the code I can't imagine how.
The historical data about Arena runs is displayed correctly in the "History" and "Arena" tabs.
My username is summer-dalaran-mage-9338
.
I was encountering the exact same bug as @mislav. Looking through the code, I noticed that the read_params
action in the Stats module was pulling stuff from cookies that could have potentially messed with the user_results
query. So I cleared my cookies just to be sure, and the bug went away! 👯
Unfortunately, I didn't check to see what was in my cookies before doing this. If I can get the bug to happen again I'll save that data to see if there is an easy way to catch it from the Stats module. But for now, clearing cookies seems to fix the problem.
EDIT: the problem seems to be with the mode
cookie being set. To easily reproduce the bug, go to /profile/stats/decks
select 'ranked' in the mode dropdown, then go to profile/stats/arena
Hot damn, @coleww. That totally did it! 🏆
I checked the cookies before 🔥ing them. There was the Google Analytics cookie (irrelevant, I suppose, the mode
cookie set to "ranked", the time_range
cookie set to last 3 days, and the main _webtracker_session
cookie (encrypted).
I think the culprit was the mode
cookie. Steps to break your Arena stats again:
- Go to Stats > Arena. The data looks fine.
- Go to Stats > Classes.
- Choose "Ranked" from the modes drop-down.
- Go to Stats > Arena. The data is now all messed up because of the
mode=ranked
cookie being persisted in the previous step.
To unbreak your cookie, however, just reset the mode with Stats > Classes: All Modes.
The 0.0 bug is fixed and deployed! Thanks for the help guys.
For posterity: 041c753f9c27c28d942865d90866fddbc05defaf