Skip to content

Fix formatting in dashboard stats test so it passes#1473

Open
SeradedStripes wants to merge 1 commit into
hackclub:mainfrom
SeradedStripes:Fix-Failing-Test
Open

Fix formatting in dashboard stats test so it passes#1473
SeradedStripes wants to merge 1 commit into
hackclub:mainfrom
SeradedStripes:Fix-Failing-Test

Conversation

@SeradedStripes

Copy link
Copy Markdown

Summary of the problem

The test in dashboard_stats_test.rb was failing
this pr fixes it

Describe your changes

Moves the DashboardRollupRefreshService call and assertions inside the travel_to block of the test.
This makes week_ranges compute relative to 2026-04-14 (where 2026-04-13 is within range) instead of the real current date where 2026-04-13 is now more than 12 weeks in the past.

Screenshots / Media

image

Copilot AI review requested due to automatic review settings July 11, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a time-dependent failure in DashboardStats service tests by ensuring rollup refresh and assertions run under the intended frozen time, so week-based ranges are computed relative to the test’s travel_to date.

Changes:

  • Move DashboardRollupRefreshService invocation and filterable_dashboard_data assertions inside the travel_to block for the affected test.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@greptile-apps

greptile-apps Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR makes the dashboard stats test use a consistent fixed time. The main changes are:

  • Moves the rollup refresh into the existing travel_to block.
  • Calculates dashboard stats and checks weekly results before restoring real time.

Confidence Score: 5/5

This looks safe to merge.

No blocking issues were found in the changed code. The fixed clock now covers the time-dependent weekly range calculation. The service and stats operations are synchronous, and block-scoped time travel is restored automatically.

T-Rex T-Rex Logs

What T-Rex did

  • A narrow test exited with status 1 before Rails loaded due to Bundler 2.3.15 being unable to parse the Gemfile's windows platform declaration.
  • I reviewed the travel-to-02-after failure log to confirm the exact target command and the complete failure output.
  • I reviewed the prerequisites log to confirm the runtime mismatch and the unavailable PostgreSQL prerequisites.

View all artifacts

T-Rex Ran code and verified through T-Rex

Important Files Changed

Filename Overview
test/services/dashboard_stats_test.rb Keeps the time-dependent rollup refresh, stats calculation, and assertions within the fixed-time scope.

Reviews (1): Last reviewed commit: "Fix formatting in dashboard stats test s..." | Re-trigger Greptile

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.

2 participants