Skip to content

New stats 6#1322

Merged
norkans7 merged 4 commits intomainfrom
new-stats-6
Dec 8, 2025
Merged

New stats 6#1322
norkans7 merged 4 commits intomainfrom
new-stats-6

Conversation

@norkans7
Copy link
Copy Markdown
Contributor

@norkans7 norkans7 commented Dec 4, 2025

No description provided.

Copilot AI review requested due to automatic review settings December 4, 2025 16:40
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 PollStats queries and comparison logging across all engagement data methods
  • Renamed variables from new_*_stats to *_stats to reflect that the new models are now the primary implementation
  • Moved DATA_TIME_FILTERS, DATA_SEGMENTS, and DATA_METRICS constants from PollStats to PollEngagementDailyCount
  • Added comprehensive test coverage for PollStatsCounter.squash() functionality
  • Removed unused Q import from ureport/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.

Comment on lines 685 to 687
gender_rate_series = PollEngagementDailyCount.get_response_rate_data(
polled_stats, responded_stats, time_filter
)
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Dec 4, 2025

Codecov Report

❌ Patch coverage is 57.14286% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.79%. Comparing base (eddbfab) to head (c1c9a68).

Files with missing lines Patch % Lines
ureport/stats/models.py 52.77% 34 Missing ⚠️
ureport/stats/tasks.py 0.00% 10 Missing ⚠️
ureport/public/views.py 75.00% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@norkans7 norkans7 merged commit 4c7fd7d into main Dec 8, 2025
2 checks passed
@norkans7 norkans7 deleted the new-stats-6 branch December 8, 2025 12:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants