tzhf / chatguessr

A Twitch chatbot for GeoGuessr.
https://chatguessr.com
MIT License
39 stars 12 forks source link

Fix victories stat after clearing #14

Closed ReAnnannanna closed 2 years ago

ReAnnannanna commented 2 years ago

Includes the time of the last guess in the game_winners view, so we can only include games that were after the user's last reset time in the victories statistic.

For some background: Stats clearing does not delete all user data, it only sets a reset_at timestamp on the users table. This is so that scoreboards for games stay intact. If we deleted all a user's guesses when they did !clear, it would have many side effects: old games could suddenly have different winners, if it is done mid-game, we would lose the guesses the user made in R1 and R2 for example, etc. So we have to keep all the guesses around even if a user clears their stats. We then use the reset_at column when calculating stats so the clearing still works as before.

image