The statistics by actor should show the actuall number of people playing #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Currently, the statistics show "4 playing" when most of the players haven't played the first attempt yet. The property
playingshould only count the games with between 1 and 10 attempts (i.e., games started but not finished).Current behavior
When a sentence is distributed to a player, a
GameRecordis created withstatus: GameStatus::InProgressandattempts: Vec::new()(repository.rs:622-634). Theget_sentence_stats()function (repository.rs:1007-1032) counts ALLInProgressgames asplaying:This includes games where
attempts.len() == 0— the player received the sentence but never opened the game or made any guess.Proposed fix
Change the counting logic to distinguish between "not started" and "actually playing":
This applies in two places:
get_sentence_stats()(line 1028)get_all_sentence_stats()(line 1062)The
totalcount should also be reconsidered: should it include games that were never started? Two options:totalcounts all distributed games (current behavior) — thentotal > won + lost + playingbecause some are "not started".totalcounts only started games — thentotal == won + lost + playing.Option 2 is cleaner for display. If option 1 is preferred, a new field
not_startedcould make the count explicit.Tests
Affected files
src/repository.rs—get_sentence_stats(),get_all_sentence_stats()src/web/templates.rs— display may need adjustment iftotalsemantics change