From 7dfa1ec8b4b1ad65ed73a6b762f8a00dbf7e10c9 Mon Sep 17 00:00:00 2001 From: Gisle Aune Date: Mon, 4 Jan 2021 18:42:24 +0100 Subject: [PATCH] change goals sorting to start_time descending, end_time ascending, so that long-term goals are pushed below the short-term from the same time span. --- database/postgres/goals.go | 2 +- svelte-ui/src/stores/goal.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/database/postgres/goals.go b/database/postgres/goals.go index 6c2f658..7833cea 100644 --- a/database/postgres/goals.go +++ b/database/postgres/goals.go @@ -51,7 +51,7 @@ func (r *goalRepository) List(ctx context.Context, filter models.GoalFilter) ([] }) } - sq = sq.OrderBy("start_time", "end_time", "name") + sq = sq.OrderBy("start_time DESC", "end_time ASC", "name") query, args, err := sq.ToSql() if err != nil { diff --git a/svelte-ui/src/stores/goal.ts b/svelte-ui/src/stores/goal.ts index 4bce7fa..893441c 100644 --- a/svelte-ui/src/stores/goal.ts +++ b/svelte-ui/src/stores/goal.ts @@ -25,7 +25,7 @@ function createGoalStore() { async load(filter: GoalFilter) { update(v => ({...v, loading: true, filter})); const goals = await stuffLogClient.listGoals(filter); - update(v => ({...v, loading: false, stale: false, goals: goals.reverse()})); + update(v => ({...v, loading: false, stale: false, goals })); }, } }