diff --git a/documentation/changelog.rst b/documentation/changelog.rst index 6fa03dede..b9b7f144b 100644 --- a/documentation/changelog.rst +++ b/documentation/changelog.rst @@ -17,6 +17,7 @@ New features Infrastructure / Support ---------------------- +* Speed up status page by choosing for a faster query (only latest belief needed) [see `PR #1142 `_] * For MacOS developers, install HiGHS solver automatically [see `PR #1187 `_] Bugfixes diff --git a/flexmeasures/data/services/sensors.py b/flexmeasures/data/services/sensors.py index 173a57f95..47de8f4e2 100644 --- a/flexmeasures/data/services/sensors.py +++ b/flexmeasures/data/services/sensors.py @@ -64,10 +64,14 @@ def get_sensors( def _get_sensor_bdf(sensor: Sensor, staleness_search: dict) -> BeliefsDataFrame | None: - """Get bdf for a given sensor with given search parameters.""" + """ + Retrieve the BeliefsDataFrame for a given sensor using the specified search parameters. The 'most_recent_only' + parameter is set to True, which ensures that only the most recent belief from the most recent event is returned. + """ bdf = TimedBelief.search( sensors=sensor, - most_recent_events_only=True, + most_recent_beliefs_only=False, + most_recent_only=True, **staleness_search, ) if bdf.empty: