Skip to content

armgit / core

Public Imported from GitHub
0

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

this case would always turn out at a 100 increase

Vincent29fec5b07544
diff --git a/ui/component/or-attribute-card/src/index.ts b/ui/component/or-attribute-card/src/index.ts
index b8765f61b..6dd84901e 100644
--- a/ui/component/or-attribute-card/src/index.ts
+++ b/ui/component/or-attribute-card/src/index.ts
@@ -359,8 +359,8 @@ export class OrAttributeCard extends LitElement {
if (currentPeriodVal && lastPeriodVal) {
if (lastPeriodVal === 0 && currentPeriodVal === 0) {
return {val: 0, unit: "%"};
- } else if (lastPeriodVal === 0 && currentPeriodVal !== 0) { // would be dividing something by zero
- return {};
+ } else if (lastPeriodVal === 0 && currentPeriodVal !== 0) {
+ return {val: 100, unit: "%"};
} else {
const math = Math.round((currentPeriodVal - lastPeriodVal) / lastPeriodVal * 100);
return {val: math, unit: "%"};