Skip to content

Commit

Permalink
TSK-1452: Revert sprint statistics display
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
  • Loading branch information
haiodo committed May 5, 2023
1 parent 6d7b2f4 commit 34276a2
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { getClient } from '@hcengineering/presentation'
import { Issue, IssueDraft } from '@hcengineering/tracker'
import { Button, ButtonKind, ButtonSize, eventToHTMLElement, showPopup } from '@hcengineering/ui'
import { EditBoxPopup } from '@hcengineering/view-resources'
import { EditBoxPopup, FixedColumn } from '@hcengineering/view-resources'
import { createEventDispatcher } from 'svelte'
import tracker from '../../../plugin'
import EstimationPopup from './EstimationPopup.svelte'
Expand Down Expand Up @@ -74,7 +74,9 @@

{#if value}
{#if kind === 'list' && '_class' in value}
<EstimationStatsPresenter {value} {kind} on:click={handleestimationEditorOpened} />
<FixedColumn key="estimation-editor-total">
<EstimationStatsPresenter {value} {kind} on:click={handleestimationEditorOpened} />
</FixedColumn>
{:else}
<Button
{focusIndex}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
$: childReportTime = floorFractionDigits(
value.reportedTime + (value.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0),
3
1
)
$: childEstimationTime = (value.childInfo ?? []).map((it) => it.estimation).reduce((a, b) => a + b, 0)
</script>
Expand All @@ -45,7 +45,7 @@
{#if value.reportedTime > 0 || childReportTime > 0}
{#if childReportTime}
{@const rchildReportTime = childReportTime}
{@const reportDiff = floorFractionDigits(rchildReportTime - value.reportedTime, 3)}
{@const reportDiff = floorFractionDigits(rchildReportTime - value.reportedTime, 1)}
{#if reportDiff !== 0 && value.reportedTime !== 0}
<div
class="flex flex-nowrap"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,15 @@
on:click
use:tooltip={{
component: Label,
props: { label: tracker.string.TimeSpendHours, params: { value: floorFractionDigits(value * 8, 2) } }
props: { label: tracker.string.TimeSpendHours, params: { value: floorFractionDigits(value * 8, 3) } }
}}
>
{#if noSymbol}
{floorFractionDigits(value, 3)}
{floorFractionDigits(value, 1)}
{:else if value > 0 && value < 1}
<Label label={tracker.string.TimeSpendHours} params={{ value: floorFractionDigits(value * 8, 1) }} />
{:else}
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value, 3) }} />
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value, 1) }} />
{/if}
</span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@
import { statusStore } from '@hcengineering/presentation'
import EstimationProgressCircle from '../issues/timereport/EstimationProgressCircle.svelte'
import TimePresenter from '../issues/timereport/TimePresenter.svelte'
import { FixedColumn } from '@hcengineering/view-resources'
export let docs: Issue[] | undefined = undefined
export let capacity: number | undefined = undefined
export let category: string | undefined = undefined
$: ids = new Set(docs?.map((it) => it._id) ?? [])
Expand Down Expand Up @@ -60,7 +62,7 @@
.reduce((it, cur) => {
return it + cur
}, 0),
3
1
)
$: totalReported = floorFractionDigits(
(noParents ?? [{ reportedTime: 0, childInfo: [] } as unknown as Issue])
Expand All @@ -76,22 +78,24 @@
.reduce((it, cur) => {
return it + cur
}, 0),
3
1
)
</script>

{#if docs}
<!-- <Label label={tracker.string.SprintDay} value={}/> -->
<div class="flex-row-center flex-no-shrink h-6" class:showWarning={totalEstimation > (capacity ?? 0)}>
<EstimationProgressCircle value={totalReported} max={totalEstimation} />
<div class="w-2 min-w-2" />
{#if totalReported > 0}
<TimePresenter value={totalReported} />
/
{/if}
<TimePresenter value={totalEstimation} />
{#if capacity}
<Label label={tracker.string.CapacityValue} params={{ value: capacity }} />
{/if}
</div>
{#if docs && (category === 'sprint' || category === 'assignee')}
<FixedColumn key="estimation-editor">
<!-- <Label label={tracker.string.SprintDay} value={}/> -->
<div class="flex-row-center flex-no-shrink h-6" class:showWarning={totalEstimation > (capacity ?? 0)}>
<EstimationProgressCircle value={totalReported} max={totalEstimation} />
<div class="w-2 min-w-2" />
{#if totalReported > 0}
<TimePresenter value={totalReported} />
/
{/if}
<TimePresenter value={totalEstimation} />
{#if capacity}
<Label label={tracker.string.CapacityValue} params={{ value: capacity }} />
{/if}
</div>
</FixedColumn>
{/if}
10 changes: 8 additions & 2 deletions plugins/view-resources/src/components/list/ListHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
ActionIcon,
AnyComponent,
Button,
Component,
IconAdd,
IconBack,
IconCheck,
Expand Down Expand Up @@ -98,7 +99,7 @@
}}
on:click={() => dispatch('collapse')}
>
<div class="flex-row-center clear-mins">
<div class="flex-row-center clear-mins flex-grow">
{#if level === 0}
<div class="chevron"><IconCollapseArrow size={'small'} /></div>
{/if}
Expand Down Expand Up @@ -152,6 +153,11 @@
{:else}
<span class="antiSection-header__counter ml-2">{items.length}</span>
{/if}
<div class="flex-row-center flex-reverse flex-grow">
{#each extraHeaders ?? [] as extra}
<Component is={extra} props={{ ...props, value: category, category: groupByKey, docs: items }} />
{/each}
</div>
</div>
{#if createItemDialog !== undefined && createItemLabel !== undefined}
<div class:on-hover={!mouseOver} class="flex-row-center">
Expand Down Expand Up @@ -190,7 +196,7 @@
position: relative;
position: sticky;
top: 0;
padding: 0 0.75rem 0 0.75rem;
padding: 0 2.5rem 0 0.75rem;
height: 2.75rem;
min-height: 2.75rem;
min-width: 0;
Expand Down
16 changes: 14 additions & 2 deletions tests/sanity/tests/tracker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,18 @@ test('my-issues', async ({ page }) => {
await expect(page.locator('.antiPanel-component')).not.toContainText(name)
})

function floorFractionDigits (n: number | string, amount: number): number {
return Number(Number(n).toFixed(amount))
}

function toTime (value: number): string {
if (value > 0 && value < 1) {
return `${floorFractionDigits(value * 8, 1)}h`
} else {
return `${floorFractionDigits(value, 1)}d`
}
}

test('report-time-from-issue-card', async ({ page }) => {
await navigate(page)
const assignee = 'Chen Rosamund'
Expand All @@ -144,7 +156,7 @@ test('report-time-from-issue-card', async ({ page }) => {
await page.click('button:has-text("Create")')
await page.click('#card-close')

await expect(page.locator('#ReportedTimeEditor')).toContainText(`${time}d`)
await expect(page.locator('#ReportedTimeEditor')).toContainText(toTime(time))
}
})

Expand Down Expand Up @@ -190,7 +202,7 @@ test('report-time-from-main-view', async ({ page }) => {
await page.click('button:has-text("Create")')
await page.click('#card-close')

await expect(page.locator('.estimation-container >> span').first()).toContainText(`${Number(count.toFixed(2))}d`)
await expect(page.locator('.estimation-container >> span').first()).toContainText(toTime(count))
}
})

Expand Down

0 comments on commit 34276a2

Please sign in to comment.