mirror of
https://github.com/danieldemus/openhab-addons
synced 2026-07-29 12:34:21 +02:00
descending order starts with last timestamp (#18789)
Signed-off-by: Bernd Weymann <bernd.weymann@gmail.com>
This commit is contained in:
+2
-1
@@ -510,12 +510,13 @@ public class RRD4jPersistenceService implements QueryablePersistenceService {
|
||||
FetchData result = request.fetchData();
|
||||
|
||||
List<HistoricItem> items = new ArrayList<>();
|
||||
long ts = result.getFirstTimestamp();
|
||||
long step = result.getRowCount() > 1 ? result.getStep() : 0;
|
||||
|
||||
double prevValue = Double.NaN;
|
||||
State prevState = null;
|
||||
double[] values = result.getValues(DATASOURCE_STATE);
|
||||
// Descending order shall start with the last timestamp and go backward
|
||||
long ts = (ordering == Ordering.DESCENDING) ? result.getLastTimestamp() : result.getFirstTimestamp();
|
||||
step = (ordering == Ordering.DESCENDING) ? -1 * step : step;
|
||||
int startIndex = (ordering == Ordering.DESCENDING) ? values.length - 1 : 0;
|
||||
int endIndex = (ordering == Ordering.DESCENDING) ? -1 : values.length;
|
||||
|
||||
Reference in New Issue
Block a user