From fbac39a487370ec0e4510e7cc6ce6d516a9fb4d0 Mon Sep 17 00:00:00 2001 From: wyattb Date: Thu, 22 Aug 2024 23:24:10 -0400 Subject: [PATCH] #172 - fixed fault display component & total timer now has client lifetime total --- .../components/active-status/active-status.component.ts | 3 ++- .../components/balancing-status/balancing-status.component.ts | 3 ++- .../components/charging-state/charging-status.component.ts | 3 ++- .../components/fault-display/fault-display.component.html | 2 +- .../components/faulted-status/faulted-status.component.ts | 3 ++- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts b/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts index 5bceafde..d15c872f 100644 --- a/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts +++ b/angular-client/src/pages/charging-page/components/active-status/active-status.component.ts @@ -12,7 +12,7 @@ import { floatPipe } from 'src/utils/pipes.utils'; export default class ActiveStatus { isActive: boolean = false; currentSeconds: number = 0; - totalSeconds: number = 0; + totalSeconds: number = Number(localStorage.getItem('active total seconds')) || 0; intervalId!: NodeJS.Timeout; constructor(private storage: Storage) {} @@ -35,6 +35,7 @@ export default class ActiveStatus { this.intervalId = setInterval(() => { this.currentSeconds++; this.totalSeconds++; + localStorage.setItem('active total seconds', this.totalSeconds.toString()); }, 1000); } diff --git a/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts b/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts index 3e3b73ee..bf9a60f3 100644 --- a/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts +++ b/angular-client/src/pages/charging-page/components/balancing-status/balancing-status.component.ts @@ -12,7 +12,7 @@ import { floatPipe } from 'src/utils/pipes.utils'; export default class BalancingStatus { isBalancing: boolean = false; currentSeconds: number = 0; - totalSeconds: number = 0; + totalSeconds: number = Number(localStorage.getItem('balancing total seconds')) || 0; intervalId!: NodeJS.Timeout; constructor(private storage: Storage) {} @@ -35,6 +35,7 @@ export default class BalancingStatus { this.intervalId = setInterval(() => { this.currentSeconds++; this.totalSeconds++; + localStorage.setItem('balancing total seconds', this.totalSeconds.toString()); }, 1000); } diff --git a/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts b/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts index 32c3560d..541c028f 100644 --- a/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts +++ b/angular-client/src/pages/charging-page/components/charging-state/charging-status.component.ts @@ -12,7 +12,7 @@ import { floatPipe } from 'src/utils/pipes.utils'; export default class ChargingStatusComponent { isCharging: boolean = false; currentSeconds: number = 0; - totalSeconds: number = 0; + totalSeconds: number = Number(localStorage.getItem('charging total seconds')) || 0; intervalId!: NodeJS.Timeout; constructor(private storage: Storage) {} @@ -36,6 +36,7 @@ export default class ChargingStatusComponent { this.intervalId = setInterval(() => { this.currentSeconds++; this.totalSeconds++; + localStorage.setItem('charging total seconds', this.totalSeconds.toString()); }, 1000); } diff --git a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html index daf30504..b68358c7 100644 --- a/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html +++ b/angular-client/src/pages/charging-page/components/fault-display/fault-display.component.html @@ -20,7 +20,7 @@ variant="info-subtitle" [content]="fault.name" additionalStyles="font-weight: bold;" - style="width: 33%; height: 40px; padding-top: 10px; width: 350px" + style="width: 33%; height: 40px; padding-top: 10px; width: 400px" > { this.currentSeconds++; this.totalSeconds++; + localStorage.setItem('faulted total seconds', this.totalSeconds.toString()); }, 1000); }