TSK-813: Remove WorkDayLength and change time reports to hours (#2763)

Signed-off-by: Vyacheslav Tumanov <me@slavatumanov.me>
This commit is contained in:
Vyacheslav Tumanov 2023-03-20 19:06:47 +05:00 committed by GitHub
parent 2817f40b82
commit 5d84053685
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 76 additions and 104 deletions

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may

View File

@ -249,7 +249,7 @@
"TimeSpendReport": "Time",
"TimeSpendReportAdd": "Add time report",
"TimeSpendReportDate": "Date",
"TimeSpendReportValue": "Reported time",
"TimeSpendReportValue": "Reported days",
"TimeSpendReportValueTooltip": "Reported time in man days",
"TimeSpendReportDescription": "Description",
"TimeSpendValue": "{value}d",
@ -283,7 +283,8 @@
"WorkDayLength": "Select length of working day",
"SevenHoursLength": "Seven Hours",
"EightHoursLength": "Eight Hours",
"CreatedOn": "Created on"
"CreatedOn": "Created on",
"HourLabel": "h"
},
"status": {}
}

View File

@ -249,7 +249,7 @@
"TimeSpendReport": "Время",
"TimeSpendReportAdd": "Добавить затраченное время",
"TimeSpendReportDate": "Дата",
"TimeSpendReportValue": "Затраченное время",
"TimeSpendReportValue": "Затраченные дни",
"TimeSpendReportValueTooltip": "Затраченное время в человеко днях",
"TimeSpendReportDescription": "Описание",
"TimeSpendValue": "{value}d",
@ -283,7 +283,8 @@
"WorkDayLength": "Выберите длину рабочего дня",
"SevenHoursLength": "Семь Часов",
"EightHoursLength": "Восемь Часов",
"CreatedOn": "Создана"
"CreatedOn": "Создана",
"HourLabel": "ч"
},
"status": {}
}

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -26,7 +26,6 @@
$: _estimation = estimation ?? value.estimation
$: workDayLength = currentProject?.workDayLength
$: childReportTime = floorFractionDigits(
value.reportedTime + (value.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0),
3
@ -49,18 +48,18 @@
{@const reportDiff = floorFractionDigits(rchildReportTime - value.reportedTime, 3)}
{#if reportDiff !== 0 && value.reportedTime !== 0}
<div class="flex flex-nowrap mr-1" class:showError={reportDiff > 0}>
<TimePresenter value={rchildReportTime} {workDayLength} />
<TimePresenter value={rchildReportTime} />
</div>
<div class="romColor">
(<TimePresenter value={value.reportedTime} {workDayLength} />)
(<TimePresenter value={value.reportedTime} />)
</div>
{:else if value.reportedTime === 0}
<TimePresenter value={childReportTime} {workDayLength} />
<TimePresenter value={childReportTime} />
{:else}
<TimePresenter value={value.reportedTime} {workDayLength} />
<TimePresenter value={value.reportedTime} />
{/if}
{:else}
<TimePresenter value={value.reportedTime} {workDayLength} />
<TimePresenter value={value.reportedTime} />
{/if}
<div class="p-1">/</div>
{/if}
@ -69,18 +68,18 @@
{@const estimationDiff = childEstTime - Math.round(_estimation)}
{#if estimationDiff !== 0}
<div class="flex flex-nowrap mr-1" class:showWarning={estimationDiff !== 0}>
<TimePresenter value={childEstTime} {workDayLength} />
<TimePresenter value={childEstTime} />
</div>
{#if _estimation !== 0}
<div class="romColor">
(<TimePresenter value={_estimation} {workDayLength} />)
(<TimePresenter value={_estimation} />)
</div>
{/if}
{:else}
<TimePresenter value={_estimation} {workDayLength} />
<TimePresenter value={_estimation} />
{/if}
{:else}
<TimePresenter value={_estimation} {workDayLength} />
<TimePresenter value={_estimation} />
{/if}
</span>
</div>

View File

@ -1,6 +1,6 @@
<!--
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
// Copyright © 2021, 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -39,7 +39,6 @@
}
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
$: workDayLength = currentProject?.workDayLength
function addTimeReport (event: MouseEvent): void {
showPopup(
@ -70,9 +69,9 @@
<div id="ReportedTimeEditor" class="link-container flex-between" on:click={showReports}>
{#if value !== undefined}
<span class="overflow-label">
<TimePresenter {value} {workDayLength} />
<TimePresenter {value} />
{#if childTime !== 0}
/ <TimePresenter value={childTime} {workDayLength} />
/ <TimePresenter value={childTime} />
{/if}
</span>
{:else}
@ -84,9 +83,9 @@
</div>
{:else if value !== undefined}
<span class="overflow-label">
<TimePresenter {value} {workDayLength} />
<TimePresenter {value} />
{#if childTime !== 0}
/ <TimePresenter value={childTime} {workDayLength} />
/ <TimePresenter value={childTime} />
{/if}
</span>
{:else}

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -13,13 +13,11 @@
// limitations under the License.
-->
<script lang="ts">
import { WorkDayLength } from '@hcengineering/tracker'
import { floorFractionDigits, Label, tooltip } from '@hcengineering/ui'
import tracker from '../../../plugin'
export let id: string | undefined = undefined
export let kind: 'link' | undefined = undefined
export let workDayLength: WorkDayLength = WorkDayLength.EIGHT_HOURS
export let value: number
</script>
@ -30,7 +28,7 @@
on:click
use:tooltip={{
component: Label,
props: { label: tracker.string.TimeSpendHours, params: { value: floorFractionDigits(value * workDayLength, 2) } }
props: { label: tracker.string.TimeSpendHours, params: { value: floorFractionDigits(value * 8, 2) } }
}}
>
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value, 3) }} />

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -30,7 +30,6 @@
issue = r as Issue
})
}
$: workDayLength = currentProject?.workDayLength
$: defaultTimeReportDay = currentProject?.defaultTimeReportDay
function editSpendReport (event: MouseEvent): void {
@ -50,5 +49,5 @@
</script>
{#if value && value.value}
<TimePresenter id="TimeSpendReportValue" kind="link" value={value.value} {workDayLength} on:click={editSpendReport} />
<TimePresenter id="TimeSpendReportValue" kind="link" value={value.value} on:click={editSpendReport} />
{/if}

View File

@ -1,14 +1,14 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
//
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
@ -18,7 +18,7 @@
import type { IntlString } from '@hcengineering/platform'
import presentation, { Card, getClient, UserBox } from '@hcengineering/presentation'
import { Issue, TimeReportDayType, TimeSpendReport } from '@hcengineering/tracker'
import { Button, DatePresenter, EditBox } from '@hcengineering/ui'
import { Button, DatePresenter, EditBox, Label } from '@hcengineering/ui'
import tracker from '../../../plugin'
import { getTimeReportDate, getTimeReportDayType } from '../../../utils'
import TitlePresenter from '../TitlePresenter.svelte'
@ -98,13 +98,25 @@
</svelte:fragment>
<div class="flex-row-center gap-2">
<EditBox focus bind:value={data.value} {placeholder} format={'number'} maxDigitsAfterPoint={3} kind={'editbox'} />
<Button kind={'link-bordered'} on:click={() => (data.value = 0.125)}><span slot="content">1/8</span></Button>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.25)}><span slot="content">1/4</span></Button>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.5)}><span slot="content">1/2</span></Button>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.75)}><span slot="content">3/4</span></Button>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.875)}><span slot="content">7/8</span></Button>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.125)}
><span slot="content">1<Label label={tracker.string.HourLabel} /></span></Button
>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.25)}
><span slot="content">2<Label label={tracker.string.HourLabel} /></span></Button
>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.5)}
><span slot="content">4<Label label={tracker.string.HourLabel} /></span></Button
>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.75)}
><span slot="content">6<Label label={tracker.string.HourLabel} /></span></Button
>
<Button kind={'link-bordered'} on:click={() => (data.value = 0.875)}
><span slot="content">7<Label label={tracker.string.HourLabel} /></span></Button
>
<div class="buttons-divider" />
<Button kind={'link-bordered'} on:click={() => (data.value = 1)}><span slot="content">1</span></Button>
<Button kind={'link-bordered'} on:click={() => (data.value = 1)}
><span slot="content">8<Label label={tracker.string.HourLabel} /></span></Button
>
</div>
<EditBox bind:value={data.description} placeholder={tracker.string.TimeSpendReportDescription} kind={'editbox'} />
<svelte:fragment slot="pool">

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -29,7 +29,6 @@
let reports: TimeSpendReport[] | undefined
$: workDayLength = projects.get(issue.space)?.workDayLength
$: subIssuesQuery.query(tracker.class.TimeSpendReport, query, async (result) => (reports = result), {
sort: { modifiedOn: SortingOrder.Descending },
lookup: {
@ -46,9 +45,9 @@
<svelte:fragment slot="title">
<span class="overflow-label flex-nowrap">
<Label label={tracker.string.ReportedTime} />:
<span class="caption-color"><TimePresenter value={reportedTime} {workDayLength} /></span>.
<span class="caption-color"><TimePresenter value={reportedTime} /></span>.
<Label label={tracker.string.TimeSpendReports} />:
<span class="caption-color"><TimePresenter value={total} {workDayLength} /></span>
<span class="caption-color"><TimePresenter value={total} /></span>
</span>
</svelte:fragment>
<TimeSpendReportsList {reports} {projects} />

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -104,7 +104,7 @@
/>
</FixedColumn>
<FixedColumn key={'timespend_reported'} justify={'center'}>
<TimePresenter value={report.value} workDayLength={currentProject?.workDayLength} />
<TimePresenter value={report.value} />
</FixedColumn>
<FixedColumn key={'timespend_date'} justify={'left'}>
<DatePresenter value={report.date} />

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -19,17 +19,8 @@
import { Asset } from '@hcengineering/platform'
import presentation, { AssigneeBox, Card, getClient } from '@hcengineering/presentation'
import { StyledTextBox } from '@hcengineering/text-editor'
import { genRanks, IssueStatus, Project, TimeReportDayType, WorkDayLength } from '@hcengineering/tracker'
import {
Button,
DropdownIntlItem,
DropdownLabelsIntl,
EditBox,
eventToHTMLElement,
Label,
showPopup,
ToggleWithLabel
} from '@hcengineering/ui'
import { genRanks, IssueStatus, Project, TimeReportDayType } from '@hcengineering/tracker'
import { Button, EditBox, eventToHTMLElement, Label, showPopup, ToggleWithLabel } from '@hcengineering/ui'
import { createEventDispatcher } from 'svelte'
import tracker from '../../plugin'
import TimeReportDayDropdown from '../issues/timereport/TimeReportDayDropdown.svelte'
@ -43,22 +34,11 @@
let icon: Asset | undefined = project?.icon ?? undefined
let selectedWorkDayType: TimeReportDayType | undefined =
project?.defaultTimeReportDay ?? TimeReportDayType.PreviousWorkDay
let selectedWorkDayLength: WorkDayLength | undefined = project?.workDayLength ?? WorkDayLength.EIGHT_HOURS
let defaultAssignee: Ref<Employee> | null | undefined = null
let members: Ref<Account>[] = project?.members ?? [getCurrentAccount()._id]
const dispatch = createEventDispatcher()
const client = getClient()
const workDayLengthItems: DropdownIntlItem[] = [
{
id: WorkDayLength.SEVEN_HOURS,
label: tracker.string.SevenHoursLength
},
{
id: WorkDayLength.EIGHT_HOURS,
label: tracker.string.EightHoursLength
}
]
$: isNew = !project
@ -83,8 +63,7 @@
defaultIssueStatus: defaultStatusId,
defaultAssignee: defaultAssignee ?? undefined,
icon,
defaultTimeReportDay: selectedWorkDayType ?? TimeReportDayType.PreviousWorkDay,
workDayLength: selectedWorkDayLength ?? WorkDayLength.EIGHT_HOURS
defaultTimeReportDay: selectedWorkDayType ?? TimeReportDayType.PreviousWorkDay
}
}
@ -139,7 +118,7 @@
label={isNew ? tracker.string.NewProject : tracker.string.EditProject}
okLabel={isNew ? presentation.string.Create : presentation.string.Save}
okAction={handleSave}
canSave={name.length > 0 && !!selectedWorkDayType && !!selectedWorkDayLength}
canSave={name.length > 0 && !!selectedWorkDayType}
on:close={() => {
dispatch('close')
}}
@ -188,19 +167,6 @@
<TimeReportDayDropdown bind:selected={selectedWorkDayType} label={tracker.string.DefaultTimeReportDay} />
</div>
<div class="flex-between">
<div class="caption">
<Label label={tracker.string.WorkDayLength} />
</div>
<DropdownLabelsIntl
kind="link-bordered"
label={tracker.string.WorkDayLength}
items={workDayLengthItems}
shouldUpdateUndefined={false}
bind:selected={selectedWorkDayLength}
/>
</div>
<div class="flex-between">
<div class="caption">
<Label label={tracker.string.Members} />

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -15,14 +15,13 @@
<script lang="ts">
import { IdMap, Ref, toIdMap } from '@hcengineering/core'
import { createQuery } from '@hcengineering/presentation'
import { Issue, IssueStatus, WorkDayLength } from '@hcengineering/tracker'
import { Issue, IssueStatus } from '@hcengineering/tracker'
import { floorFractionDigits, Label } from '@hcengineering/ui'
import tracker from '../../plugin'
import EstimationProgressCircle from '../issues/timereport/EstimationProgressCircle.svelte'
import TimePresenter from '../issues/timereport/TimePresenter.svelte'
export let docs: Issue[] | undefined = undefined
export let capacity: number | undefined = undefined
export let workDayLength: WorkDayLength = WorkDayLength.EIGHT_HOURS
$: ids = new Set(docs?.map((it) => it._id) ?? [])
@ -97,10 +96,10 @@
<EstimationProgressCircle value={totalReported} max={totalEstimation} />
<div class="w-2 min-w-2" />
{#if totalReported > 0}
<TimePresenter value={totalReported} {workDayLength} />
<TimePresenter value={totalReported} />
/
{/if}
<TimePresenter value={totalEstimation} {workDayLength} />
<TimePresenter value={totalEstimation} />
{#if capacity}
<Label label={tracker.string.CapacityValue} params={{ value: capacity }} />
{/if}

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -52,7 +52,6 @@
$: spaceQuery.query(tracker.class.Project, { _id: value.space }, (res) => {
currentProject = res.shift()
})
$: workDayLength = currentProject?.workDayLength
const handleSprintIdChanged = async (newSprintId: Ref<Sprint> | null | undefined) => {
if (!isEditable || newSprintId === undefined || value.sprint === newSprintId) {
@ -114,9 +113,9 @@
<DatePresenter value={sprint.targetDate} kind={'transparent'} />
<div class="w-2 min-w-2" />
<!-- Active sprint in time -->
<TimePresenter value={sprintDaysFrom} {workDayLength} />
<TimePresenter value={sprintDaysFrom} />
/
<TimePresenter value={sprintDaysTo} {workDayLength} />
<TimePresenter value={sprintDaysTo} />
{/if}
</div>
{/if}

View File

@ -31,7 +31,6 @@
spaceQuery.query(tracker.class.Project, { _id: sprint.space }, (res) => {
;[currentProject] = res
})
$: workDayLength = currentProject?.workDayLength
const sprintQuery = createQuery()
let sprint: Sprint | undefined
@ -67,9 +66,9 @@
<DatePresenter value={sprint.targetDate} kind={'transparent'} />
<div class="w-2 min-w-2" />
<!-- Active sprint in time -->
<TimePresenter value={sprintDaysFrom} {workDayLength} />
<TimePresenter value={sprintDaysFrom} />
/
<TimePresenter value={sprintDaysTo} {workDayLength} />
<TimePresenter value={sprintDaysTo} />
{/if}
</div>
{/if}

View File

@ -1,5 +1,5 @@
<!--
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may

View File

@ -303,7 +303,8 @@ export default mergeIds(trackerId, tracker, {
WorkDayLength: '' as IntlString,
SevenHoursLength: '' as IntlString,
EightHoursLength: '' as IntlString
EightHoursLength: '' as IntlString,
HourLabel: '' as IntlString
},
component: {
NopeComponent: '' as AnyComponent,

View File

@ -1,5 +1,5 @@
//
// Copyright © 2022 Hardcore Engineering Inc.
// Copyright © 2022-2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -54,7 +54,7 @@ export interface Project extends Space {
defaultIssueStatus: Ref<IssueStatus>
defaultAssignee?: Ref<Employee>
icon?: Asset
workDayLength: WorkDayLength
workDayLength?: WorkDayLength
defaultTimeReportDay: TimeReportDayType
}

View File

@ -139,7 +139,7 @@ test('report-time-from-issue-card', async ({ page }) => {
await page.click('#ReportsPopupAddButton')
await page.waitForSelector('text="Add time report"')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Reported\\ time"]', `${time}`)
await page.fill('[placeholder="Reported\\ days"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.click('#card-close')
@ -187,7 +187,7 @@ test('report-time-from-main-view', async ({ page }) => {
await page.click('button:has-text("Add time report")')
await page.waitForSelector('.antiCard-header >> .antiCard-header__title-wrap >> span:has-text("Add time report")')
await expect(page.locator('button:has-text("Create")')).toBeDisabled()
await page.fill('[placeholder="Reported\\ time"]', `${time}`)
await page.fill('[placeholder="Reported\\ days"]', `${time}`)
await expect(page.locator('button:has-text("Create")')).toBeEnabled()
await page.click('button:has-text("Create")')
await page.click('#card-close')