From 48b5684bd8df3af275b2a75880062a86271e171d Mon Sep 17 00:00:00 2001 From: Petr Vyazovetskiy Date: Wed, 29 Nov 2023 20:53:56 -0300 Subject: [PATCH] UBER-1083: Use hours and minutes to present less than a day durations Signed-off-by: Petr Vyazovetskiy --- packages/presentation/src/attributes.ts | 2 +- plugins/tracker-assets/lang/en.json | 1 + plugins/tracker-assets/lang/ru.json | 1 + .../issues/timereport/TimePresenter.svelte | 16 ++++++++++++++-- plugins/tracker-resources/src/plugin.ts | 2 ++ tests/sanity/tests/tracker/issues.spec.ts | 4 ++-- tests/sanity/tests/tracker/template.spec.ts | 4 ++-- 7 files changed, 23 insertions(+), 7 deletions(-) diff --git a/packages/presentation/src/attributes.ts b/packages/presentation/src/attributes.ts index d0d43ad7f71..ede5541b955 100644 --- a/packages/presentation/src/attributes.ts +++ b/packages/presentation/src/attributes.ts @@ -11,7 +11,7 @@ export interface KeyedAttribute { export { updateAttribute } from '@hcengineering/core' export function getAttribute (client: Client, object: any, key: KeyedAttribute): any { - // Check if attr is mixin and return it's value + // Check if attr is mixin and return its value if (client.getHierarchy().isMixin(key.attr.attributeOf)) { return (client.getHierarchy().as(object, key.attr.attributeOf) as any)[key.key] } else { diff --git a/plugins/tracker-assets/lang/en.json b/plugins/tracker-assets/lang/en.json index ec4751797ac..e903a346c84 100644 --- a/plugins/tracker-assets/lang/en.json +++ b/plugins/tracker-assets/lang/en.json @@ -238,6 +238,7 @@ "TimeSpendReportDescription": "Description", "TimeSpendValue": "{value}d", "TimeSpendHours": "{value}h", + "TimeSpendHoursAndMinutes": "{hours}h{minutes, plural, =0 {} other { #m}}", "ChildEstimation": "Subissues Estimation", "ChildReportedTime": "Subissues Time", "CapacityValue": "of {value}d", diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index e0a87ac08a2..7bf413e535c 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -238,6 +238,7 @@ "TimeSpendReportDescription": "Описание", "TimeSpendValue": "{value}d", "TimeSpendHours": "{value}h", + "TimeSpendHoursAndMinutes": "{hours}h{minutes, plural, =0 {} other { #m}}", "ChildEstimation": "Оценка подзадач", "ChildReportedTime": "Время подзадач", "CapacityValue": "из {value}d", diff --git a/plugins/tracker-resources/src/components/issues/timereport/TimePresenter.svelte b/plugins/tracker-resources/src/components/issues/timereport/TimePresenter.svelte index 1aa56b6b41a..f46875b101d 100644 --- a/plugins/tracker-resources/src/components/issues/timereport/TimePresenter.svelte +++ b/plugins/tracker-resources/src/components/issues/timereport/TimePresenter.svelte @@ -30,13 +30,25 @@ on:click use:tooltip={{ component: Label, - props: { label: tracker.string.TimeSpendHours, params: { value: floorFractionDigits(value, 2) } } + props: { + label: tracker.string.TimeSpendHoursAndMinutes, + params: { + hours: Math.floor(value), + minutes: floorFractionDigits((value % 1) * 60, 0) + } + } }} > {#if noSymbol} {floorFractionDigits(value, 2)} {:else if value > 0 && value < 8} -