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: timerange for sensor with a single belief #732

Merged
merged 7 commits into from Jun 20, 2023

Conversation

Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Jun 16, 2023

Loading the asset page or sensor page showed a 500 server error in the browser console, in case of finding out the timerange of a sensor with only a single data point. Pretty rare, but still a bug.

I had to fix this bug in two places, which prompted me to refactor. I wasn't able to put the util function into one of the existing modules in data/services/, because of circular imports, so I opted to create a new one, which currently just holds this one util new function.

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x added this to the 0.14.1 milestone Jun 16, 2023
@Flix6x Flix6x self-assigned this Jun 16, 2023
Copy link
Contributor

@victorgarcia98 victorgarcia98 left a comment

Choose a reason for hiding this comment

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

Thanks! Looks good.

I suggest a change that could optimize the query.

flexmeasures/data/services/timerange.py Outdated Show resolved Hide resolved
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x merged commit 3a54f3a into main Jun 20, 2023
6 of 7 checks passed
@Flix6x Flix6x deleted the bug/sensor-with-a-single-belief branch June 20, 2023 09:43
Flix6x added a commit that referenced this pull request Jun 26, 2023
* fix: get sensor data timerange in case of a single data point

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

* refactor: move to util function

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

* fix: apply fix to sensor timerange, too

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

* fix: flake8

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

* use min and max in query

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API bug Something isn't working UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants