Mark dashboard demo charging sessions

This commit is contained in:
TCFDONMEZ
2026-10-08 15:55:48 +03:00
parent ae036b9d65
commit c06c37761b
4 changed files with 6 additions and 0 deletions
+1
View File
@@ -57,6 +57,7 @@ export default async function ChargingPage() {
<div>
<div className="session-when">{dateTime(session.startedAt)}</div>
<div className="session-meta">
{session.isDemo && "Demo · "}
{duration(session.durationSeconds)}
{gained !== null && ` · %${num(session.startSocPercent as number)} → %${num(session.endSocPercent as number)}`}
</div>
+1
View File
@@ -45,6 +45,7 @@ export interface ChargingSession {
gridEnergyKwh: number;
pricePerKwh: number;
totalCost: number;
isDemo?: boolean;
startSocPercent?: number;
endSocPercent?: number;
curve: CurvePoint[];
+2
View File
@@ -49,6 +49,7 @@ export function validateChargingSession(body: unknown, pathSessionId: string): C
});
const startSocPercent = record.startSocPercent;
const endSocPercent = record.endSocPercent;
const isDemo = record.isDemo;
const energyKwh = bounded(record.energyKwh, 0, 1000, "energyKwh");
const pricePerKwh = bounded(record.pricePerKwh, 0, 1_000_000, "pricePerKwh");
const chargingLossPercent = 10;
@@ -64,6 +65,7 @@ export function validateChargingSession(body: unknown, pathSessionId: string): C
gridEnergyKwh,
pricePerKwh,
totalCost: gridEnergyKwh * pricePerKwh,
...(isDemo === true ? { isDemo: true } : {}),
...(startSocPercent === undefined ? {} : { startSocPercent: bounded(startSocPercent, 0, 100, "startSocPercent") }),
...(endSocPercent === undefined ? {} : { endSocPercent: bounded(endSocPercent, 0, 100, "endSocPercent") }),
curve,