From b8251a508967a0b102bc141b829d2f3cd357cf0e Mon Sep 17 00:00:00 2001 From: "F.N. Claessen" Date: Fri, 23 Jun 2023 12:37:45 +0200 Subject: [PATCH 1/2] fix: prevent mutating the original FIELD_DEFINITIONS dict Signed-off-by: F.N. Claessen --- flexmeasures/data/models/charts/belief_charts.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/flexmeasures/data/models/charts/belief_charts.py b/flexmeasures/data/models/charts/belief_charts.py index 7baab4757..db03e099a 100644 --- a/flexmeasures/data/models/charts/belief_charts.py +++ b/flexmeasures/data/models/charts/belief_charts.py @@ -29,7 +29,7 @@ def bar_chart( stack=None, **FIELD_DEFINITIONS["event_value"], ) - event_start_field_definition = FIELD_DEFINITIONS["event_start"] + event_start_field_definition = FIELD_DEFINITIONS["event_start"].copy() event_start_field_definition["timeUnit"] = { "unit": "yearmonthdatehoursminutesseconds", "step": sensor.event_resolution.total_seconds(), @@ -98,7 +98,7 @@ def chart_for_multiple_sensors( minimum_non_zero_resolution = min(condition) if any(condition) else timedelta(0) # Set up field definition for event starts - event_start_field_definition = FIELD_DEFINITIONS["event_start"] + event_start_field_definition = FIELD_DEFINITIONS["event_start"].copy() event_start_field_definition["timeUnit"] = { "unit": "yearmonthdatehoursminutesseconds", "step": minimum_non_zero_resolution.total_seconds(), From 472d578828f2b8fc21e94a1203205718117b02a1 Mon Sep 17 00:00:00 2001 From: "F.N. Claessen" Date: Fri, 23 Jun 2023 15:11:57 +0200 Subject: [PATCH 2/2] docs: changelog entry Signed-off-by: F.N. Claessen --- documentation/changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 29d0b8778..a89872204 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -32,6 +32,7 @@ Bugfixes * Fix browser console error when loading asset or sensor page with only a single data point [see `PR #732 `_] * Fix defaults for the ``--start-offset`` and ``--end-offset` options to ``flexmeasures add report``, which weren't being interpreted in the local timezone of the reporting sensor [see `PR #744 `_] * Relax constraint for overlaying plot traces for sensors with various resolutions, making it possible to show e.g. two price sensors in one chart, where one of them records hourly prices and the other records quarter-hourly prices [see `PR #743 `_] +* Resolve bug where different page loads would potentially influence the time axis of each other's charts, by avoiding mutation of shared field definitions [see `PR #746 `_] v0.14.0 | June 15, 2023