- Finish department cycle times.
Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
@@ -14,11 +14,21 @@ const getColor = (key) => {
|
||||
const calculateStatusDuration = (transitions, statuses) => {
|
||||
let statusDuration = {};
|
||||
let totalDuration = 0;
|
||||
let totalCurrentStatusDuration = null;
|
||||
let summations = [];
|
||||
|
||||
transitions.forEach((transition, index) => {
|
||||
let duration = transition.duration;
|
||||
totalDuration += duration;
|
||||
if (transition.start && !transition.end) {
|
||||
const startMoment = moment(transition.start);
|
||||
const nowMoment = moment();
|
||||
const duration = moment.duration(nowMoment.diff(startMoment));
|
||||
totalCurrentStatusDuration = {
|
||||
value: duration.asMilliseconds(),
|
||||
humanReadable: durationToHumanReadable(duration)
|
||||
};
|
||||
}
|
||||
|
||||
if (!transition.prev_value) {
|
||||
statusDuration[transition.value] = {
|
||||
@@ -84,6 +94,7 @@ const calculateStatusDuration = (transitions, statuses) => {
|
||||
}) : summations,
|
||||
totalStatuses: summations.length,
|
||||
total: totalDuration,
|
||||
totalCurrentStatusDuration,
|
||||
humanReadableTotal
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user