mirror of
https://github.com/hcengineering/platform.git
synced 2025-04-19 23:00:13 +00:00
Fix displaying report time in different places (#2290)
* Fix report time round Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru> * fix formatting Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru> Signed-off-by: Ruslan Bayandinov <wazsone@ya.ru>
This commit is contained in:
parent
24da818a21
commit
1aa132d66b
@ -197,15 +197,6 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
.overlay {
|
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
bottom: 0;
|
|
||||||
right: 0;
|
|
||||||
z-index: 1999;
|
|
||||||
}
|
|
||||||
|
|
||||||
.completion {
|
.completion {
|
||||||
z-index: 2000;
|
z-index: 2000;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
const doneStateQuery = createQuery()
|
const doneStateQuery = createQuery()
|
||||||
doneStateQuery.query(task.class.DoneState, {}, (res) => (doneStates = res))
|
doneStateQuery.query(task.class.DoneState, {}, (res) => (doneStates = res))
|
||||||
|
|
||||||
// Find all tags for object classe with matched elements
|
// Find all tags for object class with matched elements
|
||||||
const query = createQuery()
|
const query = createQuery()
|
||||||
|
|
||||||
$: query.query(tags.class.TagReference, { tag: { $in: $selectedTagElements } }, (result) => {
|
$: query.query(tags.class.TagReference, { tag: { $in: $selectedTagElements } }, (result) => {
|
||||||
|
@ -19,16 +19,15 @@
|
|||||||
import { Label } from '@hcengineering/ui'
|
import { Label } from '@hcengineering/ui'
|
||||||
import tracker from '../../../plugin'
|
import tracker from '../../../plugin'
|
||||||
import EstimationProgressCircle from './EstimationProgressCircle.svelte'
|
import EstimationProgressCircle from './EstimationProgressCircle.svelte'
|
||||||
|
import { floorFractionDigits } from '../../../utils'
|
||||||
|
|
||||||
export let value: Issue | AttachedData<Issue>
|
export let value: Issue | AttachedData<Issue>
|
||||||
|
|
||||||
$: childReportTime =
|
$: childReportTime = floorFractionDigits(
|
||||||
value.reportedTime + (value.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0)
|
value.reportedTime + (value.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0),
|
||||||
|
2
|
||||||
|
)
|
||||||
$: childEstimationTime = (value.childInfo ?? []).map((it) => it.estimation).reduce((a, b) => a + b, 0)
|
$: childEstimationTime = (value.childInfo ?? []).map((it) => it.estimation).reduce((a, b) => a + b, 0)
|
||||||
|
|
||||||
function hourFloor (value: number): number {
|
|
||||||
return Number(value.toFixed(2))
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="estimation-container" on:click>
|
<div class="estimation-container" on:click>
|
||||||
@ -38,22 +37,25 @@
|
|||||||
<span class="overflow-label label flex-row-center flex-nowrap text-md">
|
<span class="overflow-label label flex-row-center flex-nowrap text-md">
|
||||||
{#if value.reportedTime > 0 || childReportTime > 0}
|
{#if value.reportedTime > 0 || childReportTime > 0}
|
||||||
{#if childReportTime}
|
{#if childReportTime}
|
||||||
{@const rchildReportTime = hourFloor(childReportTime)}
|
{@const rchildReportTime = childReportTime}
|
||||||
{@const reportDiff = rchildReportTime - hourFloor(value.reportedTime)}
|
{@const reportDiff = floorFractionDigits(rchildReportTime - value.reportedTime, 2)}
|
||||||
{#if reportDiff !== 0 && value.reportedTime !== 0}
|
{#if reportDiff !== 0 && value.reportedTime !== 0}
|
||||||
<div class="flex flex-nowrap mr-1" class:showError={reportDiff > 0}>
|
<div class="flex flex-nowrap mr-1" class:showError={reportDiff > 0}>
|
||||||
<Label label={tracker.string.TimeSpendValue} params={{ value: rchildReportTime }} />
|
<Label label={tracker.string.TimeSpendValue} params={{ value: rchildReportTime }} />
|
||||||
</div>
|
</div>
|
||||||
<div class="romColor">
|
<div class="romColor">
|
||||||
(<Label label={tracker.string.TimeSpendValue} params={{ value: hourFloor(value.reportedTime) }} />)
|
(<Label
|
||||||
|
label={tracker.string.TimeSpendValue}
|
||||||
|
params={{ value: floorFractionDigits(value.reportedTime, 2) }}
|
||||||
|
/>)
|
||||||
</div>
|
</div>
|
||||||
{:else if value.reportedTime === 0}
|
{:else if value.reportedTime === 0}
|
||||||
<Label label={tracker.string.TimeSpendValue} params={{ value: hourFloor(childReportTime) }} />
|
<Label label={tracker.string.TimeSpendValue} params={{ value: childReportTime }} />
|
||||||
{:else}
|
{:else}
|
||||||
<Label label={tracker.string.TimeSpendValue} params={{ value: hourFloor(value.reportedTime) }} />
|
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value.reportedTime, 2) }} />
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<Label label={tracker.string.TimeSpendValue} params={{ value: hourFloor(value.reportedTime) }} />
|
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value.reportedTime, 2) }} />
|
||||||
{/if}
|
{/if}
|
||||||
<div class="p-1">/</div>
|
<div class="p-1">/</div>
|
||||||
{/if}
|
{/if}
|
||||||
@ -66,14 +68,17 @@
|
|||||||
</div>
|
</div>
|
||||||
{#if value.estimation !== 0}
|
{#if value.estimation !== 0}
|
||||||
<div class="romColor">
|
<div class="romColor">
|
||||||
(<Label label={tracker.string.TimeSpendValue} params={{ value: hourFloor(value.estimation) }} />)
|
(<Label
|
||||||
|
label={tracker.string.TimeSpendValue}
|
||||||
|
params={{ value: floorFractionDigits(value.estimation, 2) }}
|
||||||
|
/>)
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<Label label={tracker.string.TimeSpendValue} params={{ value: hourFloor(value.estimation) }} />
|
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value.estimation, 2) }} />
|
||||||
{/if}
|
{/if}
|
||||||
{:else}
|
{:else}
|
||||||
<Label label={tracker.string.TimeSpendValue} params={{ value: hourFloor(value.estimation) }} />
|
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value.estimation, 2) }} />
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
import type { IntlString } from '@hcengineering/platform'
|
import type { IntlString } from '@hcengineering/platform'
|
||||||
import { Issue } from '@hcengineering/tracker'
|
import { Issue } from '@hcengineering/tracker'
|
||||||
import { ActionIcon, eventToHTMLElement, IconAdd, Label, showPopup } from '@hcengineering/ui'
|
import { ActionIcon, eventToHTMLElement, IconAdd, Label, showPopup } from '@hcengineering/ui'
|
||||||
|
import { floorFractionDigits } from '../../../utils'
|
||||||
import ReportsPopup from './ReportsPopup.svelte'
|
import ReportsPopup from './ReportsPopup.svelte'
|
||||||
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
|
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
|
||||||
|
|
||||||
@ -36,14 +37,17 @@
|
|||||||
function showReports (event: MouseEvent): void {
|
function showReports (event: MouseEvent): void {
|
||||||
showPopup(ReportsPopup, { issue: object }, eventToHTMLElement(event))
|
showPopup(ReportsPopup, { issue: object }, eventToHTMLElement(event))
|
||||||
}
|
}
|
||||||
$: childTime = (object.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0)
|
$: childTime = floorFractionDigits(
|
||||||
|
(object.childInfo ?? []).map((it) => it.reportedTime).reduce((a, b) => a + b, 0),
|
||||||
|
2
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if kind === 'link'}
|
{#if kind === 'link'}
|
||||||
<div class="link-container flex-between" on:click={showReports}>
|
<div class="link-container flex-between" on:click={showReports}>
|
||||||
{#if value !== undefined}
|
{#if value !== undefined}
|
||||||
<span class="overflow-label">
|
<span class="overflow-label">
|
||||||
{value}
|
{floorFractionDigits(value, 2)}
|
||||||
{#if childTime !== 0}
|
{#if childTime !== 0}
|
||||||
/ {childTime}
|
/ {childTime}
|
||||||
{/if}
|
{/if}
|
||||||
@ -57,7 +61,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else if value !== undefined}
|
{:else if value !== undefined}
|
||||||
<span class="overflow-label">
|
<span class="overflow-label">
|
||||||
{value}
|
{floorFractionDigits(value, 2)}
|
||||||
{#if childTime !== 0}
|
{#if childTime !== 0}
|
||||||
/ {childTime}
|
/ {childTime}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import view, { AttributeModel } from '@hcengineering/view'
|
import view, { AttributeModel } from '@hcengineering/view'
|
||||||
import { getObjectPresenter } from '@hcengineering/view-resources'
|
import { getObjectPresenter } from '@hcengineering/view-resources'
|
||||||
import tracker from '../../../plugin'
|
import tracker from '../../../plugin'
|
||||||
|
import { floorFractionDigits } from '../../../utils'
|
||||||
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
|
import TimeSpendReportPopup from './TimeSpendReportPopup.svelte'
|
||||||
|
|
||||||
export let value: WithLookup<TimeSpendReport>
|
export let value: WithLookup<TimeSpendReport>
|
||||||
@ -63,7 +64,7 @@
|
|||||||
}
|
}
|
||||||
: undefined}
|
: undefined}
|
||||||
>
|
>
|
||||||
<Label label={tracker.string.TimeSpendValue} params={{ value: value.value }} />
|
<Label label={tracker.string.TimeSpendValue} params={{ value: floorFractionDigits(value.value, 2) }} />
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import { Issue, Team, TimeSpendReport } from '@hcengineering/tracker'
|
import { Issue, Team, TimeSpendReport } from '@hcengineering/tracker'
|
||||||
import { Label, Scroller, Spinner } from '@hcengineering/ui'
|
import { Label, Scroller, Spinner } from '@hcengineering/ui'
|
||||||
import tracker from '../../../plugin'
|
import tracker from '../../../plugin'
|
||||||
|
import { floorFractionDigits } from '../../../utils'
|
||||||
import TimeSpendReportsList from './TimeSpendReportsList.svelte'
|
import TimeSpendReportsList from './TimeSpendReportsList.svelte'
|
||||||
|
|
||||||
export let issue: Issue
|
export let issue: Issue
|
||||||
@ -35,11 +36,15 @@
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
$: total = (reports ?? []).reduce((a, b) => a + b.value, 0)
|
$: total = floorFractionDigits(
|
||||||
|
(reports ?? []).reduce((a, b) => a + b.value, 0),
|
||||||
|
2
|
||||||
|
)
|
||||||
|
$: reportedTime = floorFractionDigits(issue.reportedTime, 2)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if reports}
|
{#if reports}
|
||||||
<Label label={tracker.string.ReportedTime} />: {issue.reportedTime}
|
<Label label={tracker.string.ReportedTime} />: {reportedTime}
|
||||||
<Label label={tracker.string.TimeSpendReports} />: {total}
|
<Label label={tracker.string.TimeSpendReports} />: {total}
|
||||||
<div class="h-50">
|
<div class="h-50">
|
||||||
<Scroller>
|
<Scroller>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
import DatePresenter from '@hcengineering/ui/src/components/calendar/DatePresenter.svelte'
|
import DatePresenter from '@hcengineering/ui/src/components/calendar/DatePresenter.svelte'
|
||||||
import { activeSprint } from '../../issues'
|
import { activeSprint } from '../../issues'
|
||||||
import tracker from '../../plugin'
|
import tracker from '../../plugin'
|
||||||
import { getDayOfSprint } from '../../utils'
|
import { floorFractionDigits, getDayOfSprint } from '../../utils'
|
||||||
import EstimationProgressCircle from '../issues/timereport/EstimationProgressCircle.svelte'
|
import EstimationProgressCircle from '../issues/timereport/EstimationProgressCircle.svelte'
|
||||||
import SprintSelector from './SprintSelector.svelte'
|
import SprintSelector from './SprintSelector.svelte'
|
||||||
|
|
||||||
@ -64,7 +64,8 @@
|
|||||||
statuses.unsubscribe()
|
statuses.unsubscribe()
|
||||||
}
|
}
|
||||||
|
|
||||||
$: totalEstimation = (noParents ?? [{ estimation: 0, childInfo: [] } as unknown as Issue])
|
$: totalEstimation = floorFractionDigits(
|
||||||
|
(noParents ?? [{ estimation: 0, childInfo: [] } as unknown as Issue])
|
||||||
.map((it) => {
|
.map((it) => {
|
||||||
const cat = issueStatuses.get(it.status)?.category
|
const cat = issueStatuses.get(it.status)?.category
|
||||||
|
|
||||||
@ -91,8 +92,11 @@
|
|||||||
})
|
})
|
||||||
.reduce((it, cur) => {
|
.reduce((it, cur) => {
|
||||||
return it + cur
|
return it + cur
|
||||||
})
|
}),
|
||||||
$: totalReported = (noParents ?? [{ reportedTime: 0, childInfo: [] } as unknown as Issue])
|
2
|
||||||
|
)
|
||||||
|
$: totalReported = floorFractionDigits(
|
||||||
|
(noParents ?? [{ reportedTime: 0, childInfo: [] } as unknown as Issue])
|
||||||
.map((it) => {
|
.map((it) => {
|
||||||
if (it.childInfo?.length > 0) {
|
if (it.childInfo?.length > 0) {
|
||||||
const cReported = it.childInfo.map((ct) => ct.reportedTime).reduce((a, b) => a + b, 0)
|
const cReported = it.childInfo.map((ct) => ct.reportedTime).reduce((a, b) => a + b, 0)
|
||||||
@ -104,7 +108,9 @@
|
|||||||
})
|
})
|
||||||
.reduce((it, cur) => {
|
.reduce((it, cur) => {
|
||||||
return it + cur
|
return it + cur
|
||||||
})
|
}),
|
||||||
|
2
|
||||||
|
)
|
||||||
|
|
||||||
const sprintQuery = createQuery()
|
const sprintQuery = createQuery()
|
||||||
let sprint: Sprint | undefined
|
let sprint: Sprint | undefined
|
||||||
|
@ -619,3 +619,10 @@ export function getDayOfSprint (startDate: number, now: number): number {
|
|||||||
const ds = Array.from(Array(days).keys()).map((it) => stDateDate + it)
|
const ds = Array.from(Array(days).keys()).map((it) => stDateDate + it)
|
||||||
return ds.filter((it) => !isWeekend(new Date(new Date(stTime).setDate(it)))).length
|
return ds.filter((it) => !isWeekend(new Date(new Date(stTime).setDate(it)))).length
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
export const floorFractionDigits = (n: number, amount: number): number => {
|
||||||
|
return Number(n.toFixed(amount))
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user