Compare commits

...
3 Commits
Author SHA1 Message Date
gisle 0d2e027816 floating sprint progress.
continuous-integration/drone/push Build is passing
2022-08-09 21:41:42 +02:00
gisle cac4ac0bf6 filter history events by interval.
continuous-integration/drone/push Build is passing
2022-08-08 18:53:58 +02:00
gisle f5dee09e40 fix item created/acquired time in projects being shown as HH:HH 2022-08-08 18:42:04 +02:00
8 changed files with 37 additions and 12 deletions
@@ -1,4 +1,6 @@
<script lang="ts">
import { significantDecimals } from "$lib/utils/numbers";
export let target = 1;
export let count = 0;
export let green = false;
@@ -38,7 +40,7 @@
{#if percentageOnly}
<span class="ackreq">({((count / target) * 100).toFixed(0)}%)</span>
{:else}
<span class="ackreq">({Math.floor(count)} / {Math.ceil(target)})</span>
<span class="ackreq">({significantDecimals(count)} / {significantDecimals(target)})</span>
{/if}
{/if}
</div>
@@ -1,10 +1,21 @@
<script lang="ts">
import type { TimeInterval } from "$lib/models/common";
import parseInterval, { datesOf } from "$lib/utils/timeinterval";
import { getItemListContext } from "../contexts/ItemListContext.svelte";
import { getTimeContext } from "../contexts/TimeContext.svelte";
import HistoryGroupSection from "./HistoryGroupSection.svelte";
export let intervalString: string;
const {groups, items} = getItemListContext();
const {now} = getTimeContext();
let interval: TimeInterval<string>
$: interval = datesOf(parseInterval(intervalString, $now));
</script>
{#each $groups as group (group.label)}
<HistoryGroupSection group={group} items={$items} />
{#if (group.label >= interval.min && group.label <= interval.max)}
<HistoryGroupSection group={group} items={$items} />
{/if}
{/each}
@@ -20,7 +20,7 @@
t = at;
if (Math.abs(at.getTime() - ct.getTime()) < 300000) {
action = "Created/Acquired on"
action = "Created/Acquired"
} else {
action = "Acquired"
}
+1 -1
View File
@@ -141,7 +141,7 @@ export function formatPrettyTime(date: Date, now: Date) {
const diff = (d.getTime() - n.getTime()) / (86400000);
const hhmm = `${pad(date.getHours())}:${pad(date.getHours())}`;
const hhmm = `${pad(date.getHours())}:${pad(date.getMinutes())}`;
if (diff === 0) {
return `today at ${hhmm}`;
} else if (diff === 1) {
+13
View File
@@ -8,4 +8,17 @@ export default function shortestDecimal(n: number) {
}
return s;
}
export function significantDecimals(n: number) {
let s = shortestDecimal(n);
let d = s.indexOf('.');
if (d == -1) {
return s;
}
if (d >= 4) {
return s.slice(0, d);
}
return s.slice(0, 5);
}
@@ -2,7 +2,7 @@
import type { Load } from "@sveltejs/kit/types/internal";
import { sl3 } from "$lib/clients/sl3";
import parseInterval, { datesOf, intervalLabel } from "$lib/utils/timeinterval";
import parseInterval, { datesOf } from "$lib/utils/timeinterval";
import type Item from "$lib/models/item";
import type { ItemFilter, ItemGroup } from "$lib/models/item";
@@ -84,7 +84,7 @@
<ToggleIcon inverse name="calendar" bind:value={$session.groupOptions.hideScheduled} on:click={triggerReload} />
{/if}
</HistorySelector>
<HistoryGroupList />
<HistoryGroupList intervalString={intervalString} />
</Main>
<ItemCreateModal />
+2 -2
View File
@@ -9,8 +9,8 @@ import (
type Result struct {
entities.Sprint
AggregateAcquired int `json:"aggregateAcquired"`
AggregatePlanned int `json:"aggregatePlanned"`
AggregateAcquired float64 `json:"aggregateAcquired"`
AggregatePlanned float64 `json:"aggregatePlanned"`
ItemsAcquired *int `json:"itemsAcquired,omitempty"`
ItemsRequired *int `json:"itemsRequired,omitempty"`
+3 -4
View File
@@ -9,7 +9,6 @@ import (
"git.aiterp.net/stufflog3/stufflog3/usecases/projects"
"git.aiterp.net/stufflog3/stufflog3/usecases/scopes"
"golang.org/x/sync/errgroup"
"math"
"sort"
"strings"
"time"
@@ -605,11 +604,11 @@ func (s *Service) fill(ctx context.Context, sprint entities.Sprint, parts []enti
}
}
}
res.AggregateAcquired = int(math.Round(aggregateAcquired))
res.AggregatePlanned = int(math.Round(aggregatePlanned))
res.AggregateAcquired = aggregateAcquired
res.AggregatePlanned = aggregatePlanned
if res.AggregateRequired < 0 {
res.AggregateRequired = res.AggregatePlanned
res.AggregateRequired = int(res.AggregatePlanned)
}
return &res, nil