fix(charts): "7-Tage-Trend" label + numeric trend indicator on every chart incl. mood

Marc reported v1.4.15 A4 didn't fully land:
- DE label still read "7-Tage-Schnitt" / "7T-Schnitt" in places
- mood tile showed no numeric trend delta even though other tiles did

i18n rename:
- de.json + en.json: trend7dShort, movingAverage7d, moodMA all read
  "7-Tage-Trend" / "7-day trend". The legacy "7T:" / "7d:" header on
  the avg7 line is preserved for tiles that haven't been migrated to
  the trend7Delta API.

trend-delta fallback:
- summaryToTrend7Delta() now falls back to slope30 (projected onto
  7 days) when slope7 is null. Mood entries are typically logged
  less than daily, so slope7 needs ≥ 2 points within the trailing
  7-day window — for sparser users that came back null and the tile
  silently dropped the delta indicator. slope30 still answers "is
  this metric drifting?" so we project that onto the 7-day window
  for label parity.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Marc-André BombeckandClaude Opus 4.7 committed 2026-05-09 23:30:42 +02:00
1 parent 577d8dd29f
commit 4df6dac036
5 files changed
+68 -20

No files matched your search

@@ -50,7 +50,7 @@ describe("<TrendCard> 7-day trend label", () => {
/>,
);
// New label flips on for the trend variant.
expect(html).toContain("7d trend");
expect(html).toContain("7-day trend");
// Legacy avg7 short label must NOT appear in the trend variant —
// this is the whole point of the rename.
expect(html).not.toContain(">7d:<");
@@ -65,13 +65,13 @@ describe("<TrendCard> 7-day trend label", () => {
/>,
"de",
);
expect(html).toContain("7T-Trend");
expect(html).toContain("7-Tage-Trend");
});
it("keeps the legacy avg7 label when no delta is supplied (back-compat)", () => {
const html = render(<TrendCard {...baseProps} />);
expect(html).toContain("7d");
expect(html).not.toContain("7d trend");
expect(html).not.toContain("7-day trend");
});
it("renders a positive delta with `+` sign and one decimal", () => {