Merged in hotfix/2022-02-08 (pull request #374)

Resolve monthly employee efficiency for infinity.
This commit is contained in:
Patrick Fic
2022-02-08 18:05:04 +00:00

View File

@@ -54,7 +54,9 @@ export default function DashboardMonthlyEmployeeEfficiency({
const theValue = { const theValue = {
date: moment(val).format("DD"), date: moment(val).format("DD"),
...dailyHrs, // ...dailyHrs,
actual: dailyHrs.actual.toFixed(1),
productive: dailyHrs.productive.toFixed(1),
dailyEfficiency: isNaN(dailyEfficiency) ? 0 : dailyEfficiency.toFixed(1), dailyEfficiency: isNaN(dailyEfficiency) ? 0 : dailyEfficiency.toFixed(1),
accActual: accActual:
acc.length > 0 acc.length > 0
@@ -67,12 +69,18 @@ export default function DashboardMonthlyEmployeeEfficiency({
: dailyHrs.productive, : dailyHrs.productive,
accEfficiency: 0, accEfficiency: 0,
}; };
theValue.accEfficiency = (
theValue.accEfficiency =
((theValue.accProductive - theValue.accActual) / ((theValue.accProductive - theValue.accActual) /
(theValue.accActual || 1) + (theValue.accActual || 0) +
1) * 1) *
100 100;
).toFixed(1);
if (isNaN(theValue.accEfficiency)) {
theValue.accEfficiency = 0;
} else {
theValue.accEfficiency = theValue.accEfficiency.toFixed(1);
}
return [...acc, theValue]; return [...acc, theValue];
}, []); }, []);
@@ -131,6 +139,7 @@ export default function DashboardMonthlyEmployeeEfficiency({
//stackId="day" //stackId="day"
barSize={20} barSize={20}
fill="#102568" fill="#102568"
format={"0.0"}
/> />
<Bar <Bar
name="Productive Hours" name="Productive Hours"
@@ -140,6 +149,7 @@ export default function DashboardMonthlyEmployeeEfficiency({
//stackId="day" //stackId="day"
barSize={20} barSize={20}
fill="#017664" fill="#017664"
format={"0.0"}
/> />
</ComposedChart> </ComposedChart>
</ResponsiveContainer> </ResponsiveContainer>