Refactor DepartmentWeather status computation with work-hour-based thresholds: add health categories and fallback for zero hours.

This commit is contained in:
Jeppe Bundgaard
2026-03-24 15:07:55 +01:00
parent 1e6590e2df
commit bc043b95f9
@@ -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",
};
});
};