Skip to content

Commit

Permalink
fix: prevent mutating the original FIELD_DEFINITIONS dict (#746)
Browse files Browse the repository at this point in the history
* fix: prevent mutating the original FIELD_DEFINITIONS dict

Signed-off-by: F.N. Claessen <felix@seita.nl>

* docs: changelog entry

Signed-off-by: F.N. Claessen <felix@seita.nl>

---------

Signed-off-by: F.N. Claessen <felix@seita.nl>
Co-authored-by: Victor <victor@seita.nl>
  • Loading branch information
Flix6x and victorgarcia98 committed Jun 26, 2023
1 parent b80de0a commit 35bfc02
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions documentation/changelog.rst
Expand Up @@ -33,6 +33,7 @@ Bugfixes
* Fix browser console error when loading asset or sensor page with only a single data point [see `PR #732 <https://www.github.com/FlexMeasures/flexmeasures/pull/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 <https://www.github.com/FlexMeasures/flexmeasures/pull/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 <https://www.github.com/FlexMeasures/flexmeasures/pull/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 <https://www.github.com/FlexMeasures/flexmeasures/pull/746>`_]


v0.14.0 | June 15, 2023
Expand Down
4 changes: 2 additions & 2 deletions flexmeasures/data/models/charts/belief_charts.py
Expand Up @@ -33,7 +33,7 @@ def bar_chart(
event_value_field_definition["scale"] = dict(
domain={"unionWith": [0, 105]}, nice=False
)
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(),
Expand Down Expand Up @@ -103,7 +103,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(),
Expand Down

0 comments on commit 35bfc02

Please sign in to comment.