Skip to content

fix: replace stale cutoff with start/end in hourly filter#122

Open
SamzxSong wants to merge 1 commit into
phuryn:mainfrom
SamzxSong:fix/dashboard-hourly-filter-cutoff
Open

fix: replace stale cutoff with start/end in hourly filter#122
SamzxSong wants to merge 1 commit into
phuryn:mainfrom
SamzxSong:fix/dashboard-hourly-filter-cutoff

Conversation

@SamzxSong
Copy link
Copy Markdown

Summary

applyFilter() in dashboard.py referenced an undefined cutoff variable when building hourlySrc, throwing ReferenceError and preventing every chart, total, and table on the dashboard from rendering.

cutoff was leftover from before #43 introduced start/end date-range bounds; #72 (hourly activity chart) was written against the older single-cutoff pattern and merged without the rename.

Change

  • Mirror the daily filter pattern so hourly rows are gated by both start and end:
    // before
    (!cutoff || r.day >= cutoff)
    // after
    (!start || r.day >= start) && (!end || r.day <= end)
  • Add a regression test (test_hourly_filter_uses_start_end_not_cutoff) that fails if the stale name returns.

Test plan

  • New test fails before the fix, passes after
  • python3 -m unittest tests.test_dashboard — all 24 tests pass
  • Restart python3 cli.py dashboard and reload the page — Daily Token Usage, Average Hourly Distribution, By Model, Top Projects by Tokens, and Cost by Model all render

The hourly filter in applyFilter() referenced an undefined `cutoff`
variable, throwing ReferenceError and preventing every chart, total,
and table on the dashboard from rendering.

`cutoff` was leftover from before phuryn#43 introduced start/end date-range
bounds; phuryn#72 (hourly activity chart) was written against the older
single-cutoff pattern and merged without the rename. Mirror the daily
filter (line 661) so hourly rows are gated by both start and end.

Add a regression test that fails if the stale `cutoff` reference
returns.
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.

1 participant