-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor stats to use turn_scorings #129
base: master
Are you sure you want to change the base?
Conversation
33a447b
to
7226f3e
Compare
teamPlayerIds.includes(turn.player_id) | ||
) | ||
return flatMap(teamTurns, (turn) => turn.completed_card_ids).length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove dependency on completed_card_ids for this calculation since each scoring record per turn has a "score" (0, -1, 1, etc.) that will be used to determine score (no longer just number of cards)
We'll keep completed_card_ids around as a convenience for other use cases like "which cards are left in the bowl?" -- but we could also use the scoring records that are not status "skipped"
const numTurns = currentGame.turns.length | ||
const [fetchStats, { data }] = useGameStatsLazyQuery({ | ||
fetchPolicy: "no-cache", | ||
}) | ||
|
||
React.useEffect(() => { | ||
fetchStats() | ||
}, [numTurns, fetchStats]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the best I could come up with to keep this score up to date (only runs, when the number of turns change -- i.e. when a new turn is created as part of someone's turn finishing)
no-cache hits server directly, and doesn't cache the result - https://medium.com/@galen.corey/understanding-apollo-fetch-policies-705b5ad71980
highScorePlayers, | ||
teamScores, | ||
winningTeam, | ||
tie, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can add more keys here like...
teamScoresByRound
playerScoresByRound
mostDifficultCard
mostDifficultCardByRound
mostSkips
leastSkips
--- other ideas
who submitted which word
7226f3e
to
91e3c12
Compare
91e3c12
to
a7b0eca
Compare
Your Render PR Server URL is https://fishbowl-app-pr-129.onrender.com. Follow its progress at https://dashboard.render.com/static/srv-c0pgdq5ua9vrg9eih100. |
Refactor stats page + score in turn context panel to use turns --> scorings vs. turns.completed_card_ids