feature/IO-3017-Lifecycle-Average-Time - Small fixes

Signed-off-by: Dave Richer <dave@imexsystems.ca>
This commit is contained in:
Dave Richer
2024-11-08 09:32:58 -08:00
parent a14b2340b0
commit 3b19432974

View File

@@ -81,7 +81,7 @@ const jobLifecycle = async (req, res) => {
const percentage = finalTotal > 0 ? (value / finalTotal) * 100 : 0;
const color = getLifecycleStatusColor(status);
const roundedPercentage = `${Math.round(percentage)}%`;
const averageValue = _size(jobIDs) > 0 ? value / jobIDs.length : 0;
const averageValue = _.size(jobIDs) > 0 ? value / jobIDs.length : 0;
const averageHumanReadable = durationToHumanReadable(moment.duration(averageValue));
finalSummations.push({
status,
@@ -105,9 +105,9 @@ const jobLifecycle = async (req, res) => {
total: finalTotal,
statusCounts: finalStatusCounts,
humanReadable: durationToHumanReadable(moment.duration(finalTotal)),
averageValue: _size(jobIDs) > 0 ? finalTotal / jobIDs.length : 0,
averageValue: _.size(jobIDs) > 0 ? finalTotal / jobIDs.length : 0,
averageHumanReadable:
_size(jobIDs) > 0
_.size(jobIDs) > 0
? durationToHumanReadable(moment.duration(finalTotal / jobIDs.length))
: durationToHumanReadable(moment.duration(0))
}