mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-10 13:21:53 +01:00
Fix TimeSeries policy REPLACE not being applied (#4298)
Fixes #4297 Signed-off-by: Jacob Laursen <jacob-github@vindvejr.dk>
This commit is contained in:
parent
87ad314c02
commit
340996f971
@ -218,6 +218,10 @@ public class PersistenceExtensions {
|
||||
TimeZoneProvider tzProvider = timeZoneProvider;
|
||||
ZoneId timeZone = tzProvider != null ? tzProvider.getTimeZone() : ZoneId.systemDefault();
|
||||
if (service instanceof ModifiablePersistenceService modifiableService) {
|
||||
if (timeSeries.getPolicy() == TimeSeries.Policy.REPLACE) {
|
||||
internalRemoveAllStatesBetween(item, timeSeries.getBegin().atZone(timeZone),
|
||||
timeSeries.getEnd().atZone(timeZone), serviceId);
|
||||
}
|
||||
timeSeries.getStates()
|
||||
.forEach(s -> modifiableService.store(item, s.timestamp().atZone(timeZone), s.state()));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user