tzhf / chatguessr

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

Store game "in-progress"/"finished" state in the database #8

Closed ReAnnannanna closed 2 years ago

ReAnnannanna commented 2 years ago

For the Victories statistic in !me and !best, the SQL queries need to know which games have been completed. Right now they check if a game has 5 rounds and assumes then that it is complete. This is wrong, because the game has 5 rounds at the start of the 5th round, so if you do !me before the round is complete, it will already count that game.

A possible solution is to add a state column to the games table which is switched to "finished" after the game results are calculated. Then the !me and !best queries can use that instead. It will likely also be faster than the current solution.