fixing the drying calculator by making sure to update the initial time when the mode is changed
This commit is contained in:
parent
792eea73bf
commit
b2f3fac57e
1 changed files with 15 additions and 1 deletions
|
|
@ -250,6 +250,7 @@ export default function BinVisualizer(props: Props) {
|
|||
const [cfmHighOpen, setCFMHighOpen] = useState(false);
|
||||
const [{ user }] = useGlobalState();
|
||||
const [newPreset, setNewPreset] = useState<pond.BinMode>(pond.BinMode.BIN_MODE_NONE);
|
||||
const [newBinMode, setNewBinMode] = useState<pond.BinMode>(pond.BinMode.BIN_MODE_NONE);
|
||||
const [selectedCable, setSelectedCable] = useState<GrainCable>();
|
||||
const [openNodeDialog, setOpenNodeDialog] = useState(false);
|
||||
const [cableDevice, setCableDevice] = useState<Device | undefined>();
|
||||
|
|
@ -345,6 +346,7 @@ export default function BinVisualizer(props: Props) {
|
|||
setGrainOption(ToGrainOption(bin.settings.inventory.grainType));
|
||||
setBushPerTonne(bin.settings.inventory.bushelsPerTonne.toFixed(2));
|
||||
setGrainSubtype(bin.subtype());
|
||||
setNewBinMode(bin.settings.mode);
|
||||
}
|
||||
if (bin.settings) {
|
||||
let t = bin.settings.outdoorTemp;
|
||||
|
|
@ -1967,6 +1969,7 @@ export default function BinVisualizer(props: Props) {
|
|||
|
||||
const setModeStorage = () => {
|
||||
setNewPreset(pond.BinMode.BIN_MODE_STORAGE);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_STORAGE);
|
||||
};
|
||||
|
||||
const setModeCooldown = () => {
|
||||
|
|
@ -1974,6 +1977,7 @@ export default function BinVisualizer(props: Props) {
|
|||
return;
|
||||
}
|
||||
setNewPreset(pond.BinMode.BIN_MODE_COOLDOWN);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_COOLDOWN);
|
||||
};
|
||||
|
||||
const setModeDrying = () => {
|
||||
|
|
@ -1982,13 +1986,16 @@ export default function BinVisualizer(props: Props) {
|
|||
bin.settings.inventory?.initialMoisture < bin.settings.inventory?.targetMoisture
|
||||
) {
|
||||
setNewPreset(pond.BinMode.BIN_MODE_HYDRATING);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_HYDRATING);
|
||||
} else {
|
||||
setNewPreset(pond.BinMode.BIN_MODE_DRYING);
|
||||
setNewBinMode(pond.BinMode.BIN_MODE_DRYING);
|
||||
}
|
||||
};
|
||||
|
||||
const closeMoistureDialog = () => {
|
||||
setNewPreset(0);
|
||||
setNewBinMode(bin.settings.mode);
|
||||
setShowInputMoisture(false);
|
||||
};
|
||||
|
||||
|
|
@ -2049,6 +2056,7 @@ export default function BinVisualizer(props: Props) {
|
|||
<Button
|
||||
onClick={() => {
|
||||
setNewPreset(0);
|
||||
setNewBinMode(bin.settings.mode);
|
||||
setShowInputMoisture(false);
|
||||
}}
|
||||
color="primary">
|
||||
|
|
@ -2090,7 +2098,13 @@ export default function BinVisualizer(props: Props) {
|
|||
}
|
||||
if (b.settings.outdoorHumidity !== undefined)
|
||||
b.settings.outdoorHumidity = Number(outdoorHumidityInput);
|
||||
b.settings.mode = newPreset;
|
||||
|
||||
if (b.settings.mode != newBinMode){
|
||||
if(b.settings.inventory){
|
||||
b.settings.inventory.initialTimestamp = moment().format();
|
||||
}
|
||||
b.settings.mode = newBinMode;
|
||||
}
|
||||
|
||||
binAPI.updateBin(bin.key(), b.settings, as).then(resp => {
|
||||
refresh();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue