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:
parent
e0a92b56aa
commit
ceda9f1877
10 changed files with 176 additions and 16 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue