Refactor DepartmentWeather status computation with work-hour-based thresholds: add health categories and fallback for zero hours.
This commit is contained in:
@@ -118,7 +118,12 @@ const summarizeEntriesByDay = (entries) => {
|
||||
weather: getDominantWeather(dayEntries),
|
||||
washes: Number.isInteger(washes) ? washes : Number(washes.toFixed(2)),
|
||||
hours: Number(hours.toFixed(2)),
|
||||
status: getWorstStatus(dayEntries),
|
||||
/**
|
||||
* Below 1.0 cars/workhour = unhealthy (red)
|
||||
* 1.0-1.3 cars/workhour = degraded (yellow)
|
||||
* Above 1.3 cars/workhour = healthy (green)
|
||||
*/
|
||||
status: hours > 0 ? (washes / hours >= 1.3 ? "healthy" : washes / hours >= 1.0 ? "degraded" : "unhealthy") : "unknown",
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user