CEC-3751 FIx display of closed misc windows (#281)

* CEC-3751 FIx display of closed misc windows

* Oops
This commit is contained in:
John Wu
2023-02-13 13:24:29 -08:00
committed by GitHub
parent bf0f0630f1
commit 8bbebb65f7

View File

@@ -1,7 +1,7 @@
import React from "react";
import { LocalDateTimeString } from "../../utils/dates";
import { ValidateLocationByParam } from "../../utils/locations"
import { ValidateLocationByParam } from "../../utils/locations";
import useStyles from "../useStyles";
const keyValueTemplate = (key, value) => (
@@ -58,11 +58,10 @@ const DigitalTwin = (props) => {
<div className={classes.popupSection}>
<h3>Misc Windows</h3>
{Object.entries(misc_windows).map((value) => {
if (value[1] === 0) {
return keyValueTemplate(value[0], "closed");
if (value[1] === 0 || value[1] > 100) {
return keyValueTemplate(value[0], `closed ${value[1]}%`);
} else {
const percentOpen = Math.min(value[1], 100);
return keyValueTemplate(value[0], `${percentOpen}% open`);
return keyValueTemplate(value[0], `${value[1]}% open`);
}
})}
</div>