added check for timestamp
This commit is contained in:
parent
63faeacc69
commit
18916bf693
@ -279,7 +279,7 @@ public class CalculatedFieldController extends BaseController {
|
|||||||
lastUpdateTimestamp = Math.max(lastUpdateTimestamp, maxTs);
|
lastUpdateTimestamp = Math.max(lastUpdateTimestamp, maxTs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return lastUpdateTimestamp;
|
return lastUpdateTimestamp == -1 ? System.currentTimeMillis() : lastUpdateTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
private <E extends HasId<I> & HasTenantId, I extends EntityId> void checkReferencedEntities(CalculatedFieldConfiguration calculatedFieldConfig, SecurityUser user) throws ThingsboardException {
|
private <E extends HasId<I> & HasTenantId, I extends EntityId> void checkReferencedEntities(CalculatedFieldConfiguration calculatedFieldConfig, SecurityUser user) throws ThingsboardException {
|
||||||
|
|||||||
@ -113,10 +113,8 @@ public abstract class BaseCalculatedFieldState implements CalculatedFieldState {
|
|||||||
if (entry instanceof SingleValueArgumentEntry singleValueArgumentEntry) {
|
if (entry instanceof SingleValueArgumentEntry singleValueArgumentEntry) {
|
||||||
this.lastUpdateTimestamp = singleValueArgumentEntry.getTs();
|
this.lastUpdateTimestamp = singleValueArgumentEntry.getTs();
|
||||||
} else if (entry instanceof TsRollingArgumentEntry tsRollingArgumentEntry) {
|
} else if (entry instanceof TsRollingArgumentEntry tsRollingArgumentEntry) {
|
||||||
Map.Entry<Long, Double> lastEntry = tsRollingArgumentEntry.getTsRecords().pollLastEntry();
|
Map.Entry<Long, Double> lastEntry = tsRollingArgumentEntry.getTsRecords().lastEntry();
|
||||||
if (lastEntry != null) {
|
this.lastUpdateTimestamp = (lastEntry != null) ? lastEntry.getKey() : System.currentTimeMillis();
|
||||||
this.lastUpdateTimestamp = lastEntry.getKey();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user