From 1534254b2b0752684941b97e322fcb2b2023f4b8 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Fri, 3 Feb 2017 14:59:14 +0100 Subject: [PATCH] improve code quality --- server/sonar-web/src/main/js/helpers/measures.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/server/sonar-web/src/main/js/helpers/measures.js b/server/sonar-web/src/main/js/helpers/measures.js index afd6afb23d8..a7f331e990b 100644 --- a/server/sonar-web/src/main/js/helpers/measures.js +++ b/server/sonar-web/src/main/js/helpers/measures.js @@ -20,6 +20,9 @@ import numeral from 'numeral'; import { translate, translateWithParameters } from './l10n'; + +const HOURS_IN_DAY = 8; + /** * Format a measure value for a given type * @param {string|number} value @@ -285,15 +288,11 @@ function formatDurationShort (isNegative, days, hours, minutes) { return translateWithParameters('work_duration.x_minutes', formattedMinutes); } -function getHoursInDay () { - return 8; -} - function durationFormatter (value) { if (value === 0 || value === '0') { return '0'; } - const hoursInDay = getHoursInDay(); + const hoursInDay = HOURS_IN_DAY; const isNegative = value < 0; const absValue = Math.abs(value); const days = Math.floor(absValue / hoursInDay / 60); @@ -308,7 +307,7 @@ function shortDurationFormatter (value) { if (value === 0 || value === '0') { return '0'; } - const hoursInDay = getHoursInDay(); + const hoursInDay = HOURS_IN_DAY; const isNegative = value < 0; const absValue = Math.abs(value); const days = absValue / hoursInDay / 60; -- 2.39.5