Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,7 @@ def get_dashboard_data(db_path=DB_PATH):

// Hourly aggregation (filtered by model + range, then bucketed by UTC hour)
const hourlySrc = (rawData.hourly_by_model || []).filter(r =>
selectedModels.has(r.model) && (!cutoff || r.day >= cutoff)
selectedModels.has(r.model) && (!start || r.day >= start)
Comment thread
sivlek14 marked this conversation as resolved.
Outdated
);
Comment on lines 744 to 748
const hourlyAgg = aggregateHourly(hourlySrc, hourlyTZ);

Expand Down
14 changes: 14 additions & 0 deletions tests/test_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,5 +264,19 @@ def test_prices_match(self):
)


class TestApplyFilterHourlyRegression(unittest.TestCase):
"""Regression: applyFilter() referenced `cutoff` (undefined) for the hourly
chart filter instead of the `start` bound from getRangeBounds(). Any active
date range caused a ReferenceError, silently emptying the hourly chart."""

def test_no_undefined_cutoff_in_template(self):
self.assertNotIn("cutoff", HTML_TEMPLATE)

def test_hourly_filter_uses_start_bound(self):
idx = HTML_TEMPLATE.index("hourlySrc")
snippet = HTML_TEMPLATE[idx:idx + 300]
Comment on lines +272 to +277
self.assertIn("!start || r.day >= start", snippet)
Comment on lines +275 to +278


Comment on lines +275 to +280
if __name__ == "__main__":
unittest.main()
Loading