Conversation
There was a problem hiding this comment.
Pull request overview
This PR completes the migration from the legacy PollStats model to the new PollStatsCounter and PollEngagementDailyCount models by removing comparison/logging code that was used during the migration phase. The changes clean up the codebase by eliminating dual queries and validation logic, consolidating functionality into the new models.
Key changes:
- Removed old
PollStatsqueries and comparison logging across all engagement data methods - Renamed variables from
new_*_statsto*_statsto reflect that the new models are now the primary implementation - Moved
DATA_TIME_FILTERS,DATA_SEGMENTS, andDATA_METRICSconstants fromPollStatstoPollEngagementDailyCount - Added comprehensive test coverage for
PollStatsCounter.squash()functionality - Removed unused
Qimport fromureport/polls/models.py
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| ureport/utils/init.py | Removed PollStats import and cleaned up dual queries/comparison logging in get_ureporters_locations_response_rates, consolidated to use only PollEngagementDailyCount |
| ureport/stats/tasks.py | Updated imports and references from PollStats to PollEngagementDailyCount and PollStatsCounter in task functions |
| ureport/stats/models.py | Moved data constants to PollEngagementDailyCount, removed dual queries and comparison logging from all engagement methods, relocated methods between model classes |
| ureport/public/views.py | Updated view code to use PollEngagementDailyCount and PollStatsCounter instead of PollStats for engagement data and average response rate |
| ureport/polls/tests.py | Added new test_squash_poll_stats_counters test method, removed test assertions from squash tests that checked intermediate states, added PollStatsCounter object creation alongside PollStats in existing tests |
| ureport/polls/models.py | Removed PollStats import and queries, eliminated comparison logging calls, consolidated to use only PollStatsCounter for poll question calculations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ureport/stats/models.py
Outdated
| gender_rate_series = PollEngagementDailyCount.get_response_rate_data( | ||
| polled_stats, responded_stats, time_filter | ||
| ) |
There was a problem hiding this comment.
Misleading variable name: This variable is named gender_rate_series but it's in the get_scheme_response_rate_series method processing scheme data, not gender data. It should be renamed to scheme_rate_series or simply rate_series for clarity.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1322 +/- ##
==========================================
+ Coverage 83.11% 83.79% +0.67%
==========================================
Files 49 49
Lines 6124 6066 -58
==========================================
- Hits 5090 5083 -7
+ Misses 1034 983 -51 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.