Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Use "time" argument for calculating time in "Chart._get_time" #612 #613

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

pandafy
Copy link
Member

@pandafy pandafy commented Nov 5, 2024

Checklist

  • I have read the OpenWISP Contributing Guidelines.
  • I have manually tested the changes proposed in this pull request.
  • I have written new test cases for new code and/or updated existing tests for changes to existing code.
  • I have updated the documentation.

Reference to Existing Issue

Fixes #612

@@ -729,7 +729,7 @@ def _get_time(cls, time, start_date=None, end_date=None):
return start_date
if not isinstance(time, str):
return str(time)
if time in cls._get_group_map().keys():
if time in cls._get_group_map(time).keys():
Copy link
Member Author

Choose a reason for hiding this comment

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

The _get_time method handles time ranges like 1d, 7d, 30d, and 365d, returning the start date in string format for InfluxDB queries (e.g., time >= '2024-10-15').

The issue arose because the test used 5d, which was not in Chart.GROUP_MAP, causing the method to return 5d instead of a valid date, making the InfluxDB query invalid.

Passing the time argument to Chart._get_group_map, which can create custom group intervals, resolved the bug.

@nemesifier nemesifier merged commit 242e67e into master Nov 7, 2024
24 checks passed
@nemesifier nemesifier deleted the issues/612-dashboard-timeseries-view branch November 7, 2024 14:06
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.

[bug] DashboardTimeseriesView does not handle unsupported time ranges
2 participants