fix: track streak_10 in analytics (was streak_7)#222
Conversation
- analytics.py: rename streak_7_count → streak_10_count in TypedDict, compute_streak_stats() aggregation and return value - services/stats.py: read streak_10_count from game summary - server/views.py: align _VERSION with manifest.json (2.6.0) scoring.py and state.py were already correct (streak_10). The mismatched key caused streak-10 to silently drop in all analytics aggregation. Fixes #188
Summary of ChangesHello @mholzi, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a critical bug in the analytics and statistics tracking system where achievements for reaching a 10-game streak were not being correctly aggregated. The changes ensure that the system now accurately records and processes these streak achievements, providing a more reliable view of player performance. Additionally, a minor version string update was included for consistency. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
The pull request effectively addresses the identified issue where streak_10_count was not being correctly tracked and aggregated in analytics. The changes correctly update the GameRecord TypedDict, compute_streak_stats function in analytics.py, and the record_game function in services/stats.py to use streak_10_count instead of the deprecated streak_7_count. Additionally, the _VERSION in server/views.py has been aligned with manifest.json. The changes are clear and directly resolve the problem.
Root Cause
scoring.pyandstate.pycorrectly tracked/exportedstreak_10_count, butanalytics.pyandstats.pywere still readingstreak_7_count— a key that no longer exists. Every streak-10 achievement silently dropped to zero in all aggregation.Changes
analytics.pystreak_7_count→streak_10_countin TypedDict +compute_streak_stats()services/stats.pystreak_10_countfrom game summaryserver/views.py_VERSIONwithmanifest.json("2.6.0-dev" → "2.6.0")Note:
scoring.py(condition== 10) andstate.py(exportsstreak_10_count) were already correct.Testing
Existing unit tests cover streak scoring. Analytics aggregation: after this fix, games where a player hits 10 consecutive correct answers will correctly appear in streak stats.
Closes #188