mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-14 14:40:52 +00:00
style: prettier on touched insights/coach surfaces
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
21d064cfc6
commit
73e51d785e
40 files changed
+415
-413
No files matched your search
@@ -14,10 +14,7 @@ import { join } from "node:path";
|
||||
|
||||
const ROOT = join(__dirname, "../../..");
|
||||
const INSIGHTS_PATH = join(ROOT, "src/app/insights/page.tsx");
|
||||
const ANALYTICS_ROUTE_PATH = join(
|
||||
ROOT,
|
||||
"src/app/api/analytics/route.ts",
|
||||
);
|
||||
const ANALYTICS_ROUTE_PATH = join(ROOT, "src/app/api/analytics/route.ts");
|
||||
const ADVISOR_HOOK_PATH = join(
|
||||
ROOT,
|
||||
"src/components/insights/use-insights-advisor.ts",
|
||||
@@ -30,12 +27,8 @@ function load(path: string): string {
|
||||
describe("v1.4.20 B3 — /insights mounts CorrelationRow + TrendsRow", () => {
|
||||
it("imports both new components", () => {
|
||||
const src = load(INSIGHTS_PATH);
|
||||
expect(src).toContain(
|
||||
'from "@/components/insights/correlation-row"',
|
||||
);
|
||||
expect(src).toContain(
|
||||
'from "@/components/insights/trends-row"',
|
||||
);
|
||||
expect(src).toContain('from "@/components/insights/correlation-row"');
|
||||
expect(src).toContain('from "@/components/insights/trends-row"');
|
||||
});
|
||||
|
||||
it("mounts <CorrelationRow> behind a non-null analytics.correlations guard", () => {
|
||||
|
||||
@@ -222,7 +222,10 @@ async function computeCorrelationHypotheses(userId: string): Promise<{
|
||||
dailySys.set(key, list);
|
||||
}
|
||||
|
||||
const dailyCompliance = new Map<string, { expected: number; taken: number }>();
|
||||
const dailyCompliance = new Map<
|
||||
string,
|
||||
{ expected: number; taken: number }
|
||||
>();
|
||||
for (const event of intakeRows) {
|
||||
const key = dayKey(event.scheduledFor);
|
||||
const slot = dailyCompliance.get(key) ?? { expected: 0, taken: 0 };
|
||||
@@ -275,8 +278,7 @@ async function computeCorrelationHypotheses(userId: string): Promise<{
|
||||
for (const [key, moodScores] of dailyMood.entries()) {
|
||||
const pulseValues = dailyPulse.get(key);
|
||||
if (!pulseValues || pulseValues.length === 0) continue;
|
||||
const meanMood =
|
||||
moodScores.reduce((s, v) => s + v, 0) / moodScores.length;
|
||||
const meanMood = moodScores.reduce((s, v) => s + v, 0) / moodScores.length;
|
||||
const meanPulse =
|
||||
pulseValues.reduce((s, v) => s + v, 0) / pulseValues.length;
|
||||
moodPulsePairs.push({
|
||||
@@ -449,9 +451,7 @@ async function computeUserHealthScore(
|
||||
// anchor still captures the same logical 30 days.
|
||||
const shifted = events.map((e) => ({
|
||||
scheduledFor: new Date(e.scheduledFor.getTime() + 7 * DAY_MS),
|
||||
takenAt: e.takenAt
|
||||
? new Date(e.takenAt.getTime() + 7 * DAY_MS)
|
||||
: null,
|
||||
takenAt: e.takenAt ? new Date(e.takenAt.getTime() + 7 * DAY_MS) : null,
|
||||
skipped: e.skipped,
|
||||
}));
|
||||
return calculateCompliance(shifted, med.schedules, 30, med.createdAt)
|
||||
|
||||
+13
-11
@@ -907,9 +907,11 @@ export default function InsightsPage() {
|
||||
// cached AI payload carries a weeklyReport block. The banner deep-
|
||||
// links into `/insights/report/[week]` for Read / Share / Export PDF.
|
||||
const weeklyReport = (
|
||||
advisor.payload?.insights as {
|
||||
weeklyReport?: { weekISO: string } | null;
|
||||
} | undefined
|
||||
advisor.payload?.insights as
|
||||
| {
|
||||
weeklyReport?: { weekISO: string } | null;
|
||||
}
|
||||
| undefined
|
||||
)?.weeklyReport;
|
||||
const weeklyReportReady = weeklyReport
|
||||
? {
|
||||
@@ -930,11 +932,13 @@ export default function InsightsPage() {
|
||||
// 4.20.2 simply produce an empty array.
|
||||
const rawStoryboard = (
|
||||
advisor.payload?.insights as
|
||||
| { storyboardAnnotations?: Array<{
|
||||
date: string;
|
||||
label: string;
|
||||
category: string;
|
||||
}> }
|
||||
| {
|
||||
storyboardAnnotations?: Array<{
|
||||
date: string;
|
||||
label: string;
|
||||
category: string;
|
||||
}>;
|
||||
}
|
||||
| undefined
|
||||
)?.storyboardAnnotations;
|
||||
const bpStoryboardAnnotations = (rawStoryboard ?? []).map((entry) => ({
|
||||
@@ -991,9 +995,7 @@ export default function InsightsPage() {
|
||||
with an inline AI-authored sentence below each. Annotations come
|
||||
from `advisor.payload.trendAnnotations` (PROMPT_VERSION 4.20.1+);
|
||||
legacy cached payloads simply paint the per-metric empty hint. */}
|
||||
<TrendsRow
|
||||
annotations={advisor.payload?.trendAnnotations ?? null}
|
||||
/>
|
||||
<TrendsRow annotations={advisor.payload?.trendAnnotations ?? null} />
|
||||
|
||||
{/* v1.4.16 phase D reconcile (CRITICAL C1) — wire the polished
|
||||
`<InsightAdvisorCard>` (severity-ordered recommendations grid +
|
||||
|
||||
Reference in new issue
Block a user