From 1acd8c3bffb6aa9b3a439d1311ad2ae455eeab4f Mon Sep 17 00:00:00 2001 From: olsch01 Date: Wed, 11 Mar 2026 15:51:12 -0400 Subject: [PATCH] fix: check reserve-funded projects instead of unused reserve_components table The missing-data warning was checking the reserve_components table, which users never populate. All reserve data lives in the projects table. Now only warns when no reserve-funded projects exist. Co-Authored-By: Claude Opus 4.6 --- .../modules/health-scores/health-scores.service.ts | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/backend/src/modules/health-scores/health-scores.service.ts b/backend/src/modules/health-scores/health-scores.service.ts index cece9be..6d0e3c9 100644 --- a/backend/src/modules/health-scores/health-scores.service.ts +++ b/backend/src/modules/health-scores/health-scores.service.ts @@ -220,20 +220,12 @@ export class HealthScoresService { missing.push(`No budget found for ${year}. Upload or create an annual budget.`); } - // Should have reserve components (warn but don't block) - const components = await qr.query( - `SELECT COUNT(*) as cnt FROM reserve_components`, - ); - if (parseInt(components[0].cnt) === 0) { - missing.push('No reserve components found. Add reserve components (roof, parking, pool, etc.) with replacement costs for an accurate funded-ratio calculation.'); - } - - // Should have capital projects (warn but don't block) + // Should have reserve-funded projects with estimated costs (warn but don't block) const projects = await qr.query( - `SELECT COUNT(*) as cnt FROM projects WHERE is_active = true`, + `SELECT COUNT(*) as cnt FROM projects WHERE is_active = true AND fund_source = 'reserve'`, ); if (parseInt(projects[0].cnt) === 0) { - missing.push('No capital projects found. Add planned capital projects for a more accurate reserve health assessment.'); + missing.push('No reserve-funded projects found. Add projects with estimated costs for an accurate funded-ratio calculation.'); } }