mirror of
https://github.com/danieldemus/openhab-core.git
synced 2025-01-25 11:45:49 +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;
|
TimeZoneProvider tzProvider = timeZoneProvider;
|
||||||
ZoneId timeZone = tzProvider != null ? tzProvider.getTimeZone() : ZoneId.systemDefault();
|
ZoneId timeZone = tzProvider != null ? tzProvider.getTimeZone() : ZoneId.systemDefault();
|
||||||
if (service instanceof ModifiablePersistenceService modifiableService) {
|
if (service instanceof ModifiablePersistenceService modifiableService) {
|
||||||
|
if (timeSeries.getPolicy() == TimeSeries.Policy.REPLACE) {
|
||||||
|
internalRemoveAllStatesBetween(item, timeSeries.getBegin().atZone(timeZone),
|
||||||
|
timeSeries.getEnd().atZone(timeZone), serviceId);
|
||||||
|
}
|
||||||
timeSeries.getStates()
|
timeSeries.getStates()
|
||||||
.forEach(s -> modifiableService.store(item, s.timestamp().atZone(timeZone), s.state()));
|
.forEach(s -> modifiableService.store(item, s.timestamp().atZone(timeZone), s.state()));
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user