From 5d98a98c210f4419e4320cc78847d81ddd1fd677 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Sat, 8 Aug 2026 02:07:21 +0200 Subject: [PATCH] refactor(mood): drop the orientation helper until something needs it The inverse flag is read by the trend legend and by the assistant block; the function that flips a value through it had no caller. It comes back with the surface that needs a combined view, not before. --- src/lib/mood/__tests__/dimensions.test.ts | 25 ----------------------- src/lib/mood/dimensions.ts | 16 --------------- 2 files changed, 41 deletions(-) diff --git a/src/lib/mood/__tests__/dimensions.test.ts b/src/lib/mood/__tests__/dimensions.test.ts index 5782f1900..2e94c5843 100644 --- a/src/lib/mood/__tests__/dimensions.test.ts +++ b/src/lib/mood/__tests__/dimensions.test.ts @@ -5,7 +5,6 @@ import { MOOD_DIMENSION_MAX, MOOD_DIMENSION_MIN, getMoodDimension, - orientForComparison, } from "@/lib/mood/dimensions"; describe("MOOD_DIMENSIONS", () => { @@ -61,27 +60,3 @@ describe("MOOD_DIMENSIONS", () => { expect(getMoodDimension("")).toBeUndefined(); }); }); - -describe("orientForComparison", () => { - const a1 = MOOD_DIMENSIONS[0]; - const a2 = MOOD_DIMENSIONS[1]; - - it("leaves an upright dimension alone", () => { - expect(orientForComparison(a1, 0)).toBe(0); - expect(orientForComparison(a1, 7)).toBe(7); - expect(orientForComparison(a1, 10)).toBe(10); - }); - - it("flips the inverse dimension around the scale", () => { - expect(orientForComparison(a2, 0)).toBe(10); - expect(orientForComparison(a2, 3)).toBe(7); - expect(orientForComparison(a2, 10)).toBe(0); - }); - - it("answers null for an absent value rather than a neutral one", () => { - expect(orientForComparison(a1, null)).toBeNull(); - expect(orientForComparison(a1, undefined)).toBeNull(); - expect(orientForComparison(a2, null)).toBeNull(); - expect(orientForComparison(a2, Number.NaN)).toBeNull(); - }); -}); diff --git a/src/lib/mood/dimensions.ts b/src/lib/mood/dimensions.ts index 31f6b6ba9..8f692d6cd 100644 --- a/src/lib/mood/dimensions.ts +++ b/src/lib/mood/dimensions.ts @@ -120,19 +120,3 @@ const BY_KEY = new Map( export function getMoodDimension(key: string): MoodDimension | undefined { return BY_KEY.get(key); } - -/** - * Turn a stored value into one where "up" reads as "better". - * - * The only legal way to normalise an inverse dimension. Returns `null` for an - * absent value, because an unanswered dimension is not a neutral one — the - * whole point of leaving A2..A5 nullable is that absence stays readable as - * absence. - */ -export function orientForComparison( - dimension: MoodDimension, - value: number | null | undefined, -): number | null { - if (typeof value !== "number" || !Number.isFinite(value)) return null; - return dimension.inverse ? dimension.max - value : value; -}