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 <noreply@anthropic.com>
This commit is contained in:
@@ -220,20 +220,12 @@ export class HealthScoresService {
|
|||||||
missing.push(`No budget found for ${year}. Upload or create an annual budget.`);
|
missing.push(`No budget found for ${year}. Upload or create an annual budget.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Should have reserve components (warn but don't block)
|
// Should have reserve-funded projects with estimated costs (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)
|
|
||||||
const projects = await qr.query(
|
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) {
|
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.');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user