IO-2240 Resolve efficiency calculation issue.
This commit is contained in:
@@ -223,18 +223,31 @@ export default function ScoreboardTimeTickets() {
|
|||||||
|
|
||||||
ret2.push(r);
|
ret2.push(r);
|
||||||
});
|
});
|
||||||
|
console.log(
|
||||||
|
"🚀 ~ file: scoreboard-timetickets.component.jsx:238 ~ calculatedData ~ ret:",
|
||||||
|
ret
|
||||||
|
);
|
||||||
|
|
||||||
// Add total efficiency of employees
|
// Add total efficiency of employees
|
||||||
ret.totalEffieciencyOverPeriod = Object.keys(ret.employees)
|
const totalActualAndProductive = Object.keys(ret.employees)
|
||||||
.map((key) => {
|
.map((key) => {
|
||||||
return { employee_number: key, ...ret.employees[key] };
|
return { employee_number: key, ...ret.employees[key] };
|
||||||
})
|
})
|
||||||
.map((e) =>
|
.reduce(
|
||||||
((e.totalOverPeriod / (e.actualTotalOverPeriod || 0.1)) * 100).toFixed(
|
(acc, e) => {
|
||||||
1
|
return {
|
||||||
)
|
totalOverPeriod: acc.totalOverPeriod + e.totalOverPeriod,
|
||||||
)
|
actualTotalOverPeriod:
|
||||||
.reduce((acc, prev) => acc + Number(prev), 0);
|
acc.actualTotalOverPeriod + e.actualTotalOverPeriod,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{ totalOverPeriod: 0, actualTotalOverPeriod: 0 }
|
||||||
|
);
|
||||||
|
|
||||||
|
ret.totalEffieciencyOverPeriod =
|
||||||
|
(totalActualAndProductive.totalOverPeriod /
|
||||||
|
totalActualAndProductive.actualTotalOverPeriod) *
|
||||||
|
100;
|
||||||
|
|
||||||
roundObject(ret);
|
roundObject(ret);
|
||||||
roundObject(totals);
|
roundObject(totals);
|
||||||
|
|||||||
Reference in New Issue
Block a user