fix(editor): Fix Insights display time saved from minutes (#14622)

This commit is contained in:
Guillaume Jacquart
2025-04-15 09:38:01 +02:00
committed by GitHub
parent 46d9b60049
commit 6dd7756191
7 changed files with 29 additions and 29 deletions

View File

@@ -12,7 +12,7 @@ export const INSIGHTS_UNIT_MAPPING: Record<InsightsSummaryType, (value: number)
total: () => '',
failed: () => '',
failureRate: () => '%',
timeSaved: (value: number) => (Math.abs(value) < 3600 ? 'm' : 'h'),
timeSaved: (value: number) => (Math.abs(value) < 60 ? 'm' : 'h'),
averageRunTime: () => 's',
} as const;
@@ -23,7 +23,7 @@ export const INSIGHTS_DEVIATION_UNIT_MAPPING: Record<
total: () => '%',
failed: () => '%',
failureRate: () => 'pp',
timeSaved: (deviation: number) => (Math.abs(deviation) < 3600 ? 'm' : 'h'),
timeSaved: (deviation: number) => (Math.abs(deviation) < 60 ? 'm' : 'h'),
averageRunTime: () => 's',
} as const;

View File

@@ -6,8 +6,8 @@ import {
INSIGHTS_DEVIATION_UNIT_MAPPING,
} from '@/features/insights/insights.constants';
export const transformInsightsTimeSaved = (seconds: number): number =>
Math.round(seconds / (Math.abs(seconds) < 3600 ? 60 : 3600)); // we want to show saved time in minutes or hours
export const transformInsightsTimeSaved = (minutes: number): number =>
Math.round(minutes / (Math.abs(minutes) < 60 ? 1 : 60)); // we want to show saved time in minutes or hours
export const transformInsightsAverageRunTime = (ms: number): number => ms / 1000; // we want to show average run time in seconds
export const transformInsightsFailureRate = (value: number): number => value * 100; // we want to show failure rate in percentage