Skip to content

Commit

Permalink
Fix rendering of mean times
Browse files Browse the repository at this point in the history
Fixes #923.

The "mean run time" and the "mean queue time" in the services table
could show as timestamps instead of durations. This patch
should fix that.
  • Loading branch information
Arnei committed Jan 28, 2025
1 parent 9677832 commit d0d38ab
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/components/systems/partials/MeanQueueTimeCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { renderValidDate } from "../../../utils/dateUtils";
import { Service } from "../../../slices/serviceSlice";
import moment from "moment";

/**
* This component renders the mean queue time cells of systems in the table view
Expand All @@ -11,11 +10,10 @@ const MeanQueueTimeCell = ({
}: {
row: Service
}) => {
const { t } = useTranslation();

return (
<span>
{t("dateFormats.time.medium", { time: renderValidDate(row.meanQueueTime.toString()) })}
{ moment.utc(moment.duration(row.meanQueueTime* 1000).asMilliseconds()).format("HH:mm:ss") }
</span>
);
};
Expand Down
6 changes: 2 additions & 4 deletions src/components/systems/partials/MeanRunTimeCell.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { renderValidDate } from "../../../utils/dateUtils";
import { Service } from "../../../slices/serviceSlice";
import moment from "moment";

/**
* This component renders the mean run time cells of systems in the table view
Expand All @@ -11,11 +10,10 @@ const MeanRunTimeCell = ({
}: {
row: Service
}) => {
const { t } = useTranslation();

return (
<span>
{t("dateFormats.time.medium", { time: renderValidDate(row.meanRunTime.toString()) })}
{ moment.utc(moment.duration(row.meanRunTime * 1000).asMilliseconds()).format("HH:mm:ss") }
</span>
);
};
Expand Down

0 comments on commit d0d38ab

Please sign in to comment.