Skip to content
Snippets Groups Projects
Commit 3afd10cc authored by Robert Goldmann's avatar Robert Goldmann
Browse files

SensorLineChartTile: Refactoring: externalized fetching min/max values from service

parent cbfd0efd
No related branches found
No related tags found
No related merge requests found
...@@ -117,6 +117,10 @@ class SensorLineChartTile(Tile): ...@@ -117,6 +117,10 @@ class SensorLineChartTile(Tile):
else: else:
return 0, 0 + self.MAX_Y_AXIS_SPACING return 0, 0 + self.MAX_Y_AXIS_SPACING
return self.__get_min_max_from_service(pageName, startDateTime, endDateTime, storageLeafService)
def __get_min_max_from_service(self, pageName: str, startDateTime: str, endDateTime: str,
storageLeafService: MultiCacheKeyService):
minMaxSettings = { minMaxSettings = {
'url': self._settings['url'], 'url': self._settings['url'],
'sensorIDsForMinMax': self._settings['sensorIDsForMinMax'], 'sensorIDsForMinMax': self._settings['sensorIDsForMinMax'],
...@@ -124,6 +128,7 @@ class SensorLineChartTile(Tile): ...@@ -124,6 +128,7 @@ class SensorLineChartTile(Tile):
'startDateTime': startDateTime, 'startDateTime': startDateTime,
'endDateTime': endDateTime 'endDateTime': endDateTime
} }
cacheKey = f'{pageName}_{self._uniqueName}_minMax' cacheKey = f'{pageName}_{self._uniqueName}_minMax'
minMaxData = storageLeafService.get_data(cacheKey, self._intervalInSeconds, minMaxSettings) minMaxData = storageLeafService.get_data(cacheKey, self._intervalInSeconds, minMaxSettings)
LOGGER.debug(f'Received min/max: {minMaxData} for sensorIDs: {self._settings["sensorIDsForMinMax"]}') LOGGER.debug(f'Received min/max: {minMaxData} for sensorIDs: {self._settings["sensorIDsForMinMax"]}')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment