aboutsummaryrefslogtreecommitdiff
path: root/src/lib/server/services/routines.test.ts
diff options
context:
space:
mode:
authorMartin Kagamino Lehoux <martin@lehoux.net>2026-09-08 15:53:07 +0200
committerMartin Kagamino Lehoux <martin@lehoux.net>2026-09-08 15:53:07 +0200
commit6d69c7b1e6a8051338e052cc9d1836f4f1a20f51 (patch)
tree33af9e78d93afe34f113aad116d3e5e4ed2a5fc1 /src/lib/server/services/routines.test.ts
parent212c3adc8a584e6517a2816fc6683688d5ac5d7a (diff)
Late only after a full missed period
Status buckets shift a full period out: due until an occurrence is skipped entirely, late after one, very late after two. Health decay halves (100 - ratio*50) so 50 marks late and 0 marks veryLate.
Diffstat (limited to 'src/lib/server/services/routines.test.ts')
-rw-r--r--src/lib/server/services/routines.test.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/lib/server/services/routines.test.ts b/src/lib/server/services/routines.test.ts
index 04151c2..22b49ff 100644
--- a/src/lib/server/services/routines.test.ts
+++ b/src/lib/server/services/routines.test.ts
@@ -134,9 +134,8 @@ describe('routines service', () => {
const r = await add(projectId, 'clean kitchen', 7, db);
const createdAt = Date.parse(r.createdAt);
await complete(r.id, null, new Date(createdAt).toISOString(), db);
-
- // 15 days after completion with a 7-day routine => very late
- const now = createdAt + 15 * DAY_MS;
+ // 22 days after completion with a 7-day routine => two periods overdue
+ const now = createdAt + 22 * DAY_MS;
const dashboard = await loadProjectDashboard(projectId, now, db);
expect(dashboard.routines).toHaveLength(1);
expect(dashboard.routines[0].status).toBe('veryLate');