Skip to content

Support start_time and end_time query parameters #1030

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

Merged
merged 9 commits into from
Apr 10, 2024
Merged

Conversation

nrozanov
Copy link
Contributor

@nrozanov nrozanov commented Apr 4, 2024

Description

Support start_time and end_time query parameters for GET /assets/<id> call

Look & Feel

.

How to test

Pass new parameters to GET /assets/<id>, check we get data that is more recent than start_time and older than end_time

Further Improvements

.

Related Items

.


  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on code under GPL or other license that is incompatible with FlexMeasures

Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
@nrozanov nrozanov requested review from Flix6x and nhoening April 4, 2024 09:41
@nrozanov nrozanov linked an issue Apr 4, 2024 that may be closed by this pull request
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Good start!

  • Let's add a small link icon under the graphs on the asset page (or next to it), to copy the link to the current view. That would make it easy to share the current view with others.
  • I would like the date picker to reflect the time range, as well.
  • Please check the parameters better. They lead to an error if the timezone info is missing or if they are None - see this screenshot

One more thing I see (maybe not caused by this PR: When I reload the asset page, it doesn't pick the time range from the session (the /assets/<id>/chart endpoint calls set_session_variables("event_starts_after", "event_ends_before")), but goes back to the default (today + tomorrow). The sensor page seems to do that correct. This could also become another issue.

nrozanov added 2 commits April 5, 2024 11:17
Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
nrozanov added 2 commits April 9, 2024 11:40
…url on copying

Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Great work, almost there.

I noticed one potential small bug: When I select a few days in the datepicker, e.g. 22.-25 of April, then copy the link and apply it, then the date picker has marked only 22.-24. of April.
When I set the timezone offset of the end_date in the URL to 00:00 and reload, it shows 22.-25. In base.html, line 470f, the picker throws off hours, that might be the reason.
We can also make a new issue out of this, it wasn't caused by this PR.

nrozanov added 2 commits April 9, 2024 15:28
Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Thanks!

@nhoening
Copy link
Contributor

nhoening commented Apr 9, 2024

Please add a changelog entry, then we'll merge!

nrozanov and others added 2 commits April 10, 2024 09:57
Signed-off-by: Nikolai Rozanov <nickolay.rozanov@gmail.com>
Signed-off-by: Nicolas Höning <nicolas@seita.nl>
@nhoening nhoening merged commit 9446caa into main Apr 10, 2024
7 of 9 checks passed
@nhoening nhoening deleted the get-asset-dates branch April 10, 2024 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow links to asset page with start and end time in the URL
3 participants