Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

clause won't be used

Vincent58e49adf0c56
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index 2b3f985d0..0cf3d5abf 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -322,15 +322,11 @@ export class OrAttributeCard extends LitElement {
if (changedProperties.has("data")) {
this._chart.data.datasets![0].data = this.data;
this._chart.update();
- }
- }
-
- if (changedProperties.has("mainValue") || changedProperties.has("mainValueLastPeriod")) {
- if (this.mainValueLastPeriod !== undefined && this.mainValue !== undefined) {
- this.delta = this.getFormattedDelta(this.mainValue, this.mainValueLastPeriod);
+ this.delta = this.getFormattedDelta(this.getFirstKnownMeasurement(this.data), this.getLastKnownMeasurement(this.data));
this.deltaPlus = (this.delta.val && this.delta.val > 0) ? "+" : "";
}
}
+
if (changedProperties.has("mainValue")) {
this.formattedMainValue = this.getFormattedValue(this.mainValue!);
}