Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0d2e027816 | ||
|
|
cac4ac0bf6 | ||
|
|
f5dee09e40 |
@@ -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)}
|
||||
{#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"
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -9,3 +9,16 @@ 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 />
|
||||
|
||||
@@ -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"`
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user