profile-weekly-distance: weekly distance bar chart on the profile

Implements the profile-weekly-distance change (specs/profile-weekly-distance):

- getWeeklyDistance(ownerId, { publicOnly, weeks=12 }) in activities.server.ts:
  one query that gap-fills in SQL — generate_series of week-starts LEFT JOINed
  to activities — so it returns exactly 12 contiguous { weekStart, distance }
  rows with matching Postgres week boundaries, viewer-scoped, no cache, no
  schema change.
- WeeklyDistanceChart: SVG bars normalized to the busiest week (empty weeks keep
  their slot as zero-height bars), per-bar title distance, localized label;
  renders nothing when there's no distance in the window. Mounted under the
  ProfileStats header.
- i18n journal.profileStats.weeklyDistance (en + de).

Tests: WeeklyDistanceChart component (jsdom: bar count incl. zero weeks, empty
→ hidden, normalization); e2e creates an activity with distance and asserts the
chart renders. typecheck + lint + unit (journal 321) green; verified in the
browser.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Ullrich Schäfer 2026-06-13 07:46:06 +02:00
parent e0a92b56aa
commit ceda9f1877
No known key found for this signature in database
GPG key ID: A32FF691A0F752D9
10 changed files with 176 additions and 16 deletions

View file

@ -415,6 +415,7 @@ export default {
ascent: "Anstieg",
time: "Zeit",
last4Weeks: "{{count}} in den letzten 4 Wochen",
weeklyDistance: "Wochendistanz (letzte 12 Wochen)",
},
settings: {
title: "Einstellungen",

View file

@ -415,6 +415,7 @@ export default {
ascent: "Ascent",
time: "Time",
last4Weeks: "{{count}} in the last 4 weeks",
weeklyDistance: "Weekly distance (last 12 weeks)",
},
settings: {
title: "Settings",