Fixed modal displaying negative remaining times

This commit is contained in:
Arnaud Vergnet 2020-05-01 16:18:55 +02:00
parent ea16a1f50f
commit 9e4e340302

View file

@ -267,6 +267,10 @@ class ProxiwashScreen extends React.Component<Props, State> {
let message = modalStateStrings[ProxiwashConstants.machineStates[item.state]]; let message = modalStateStrings[ProxiwashConstants.machineStates[item.state]];
const onPress = this.onSetupNotificationsPress.bind(this, item); const onPress = this.onSetupNotificationsPress.bind(this, item);
if (ProxiwashConstants.machineStates[item.state] === ProxiwashConstants.machineStates["EN COURS"]) { if (ProxiwashConstants.machineStates[item.state] === ProxiwashConstants.machineStates["EN COURS"]) {
let remainingTime = parseInt(item.remainingTime)
if (remainingTime < 0)
remainingTime = 0;
button = button =
{ {
text: isMachineWatched(item, this.state.machinesWatched) ? text: isMachineWatched(item, this.state.machinesWatched) ?
@ -280,7 +284,7 @@ class ProxiwashScreen extends React.Component<Props, State> {
{ {
start: item.startTime, start: item.startTime,
end: item.endTime, end: item.endTime,
remaining: item.remainingTime remaining: remainingTime
}); });
} else if (ProxiwashConstants.machineStates[item.state] === ProxiwashConstants.machineStates.DISPONIBLE) { } else if (ProxiwashConstants.machineStates[item.state] === ProxiwashConstants.machineStates.DISPONIBLE) {
if (isDryer) if (isDryer)