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