Merge pull request #147 from Hestia-Homes/new-reporting

changed net cost to gross
This commit is contained in:
KhalimCK 2025-12-09 07:41:44 +08:00 committed by GitHub
commit d863433d8d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 5 deletions

View file

@ -139,6 +139,6 @@ export async function GET(
contingency,
total_funding,
net_cost,
net_cost_per_unit: n_units_upgraded > 0 ? net_cost / n_units_upgraded : 0,
gross_per_unit: n_units_upgraded > 0 ? total_cost / n_units_upgraded : 0,
});
}

View file

@ -123,7 +123,7 @@ export function ReportingClientArea({
? scenarioData.total_cost / scenarioData.total_carbon
: 0,
netCost: scenarioData.net_cost,
netCostPerUnit: scenarioData.net_cost_per_unit,
grossPerUnit: scenarioData.gross_per_unit,
nUnits: scenarioData.n_units_upgraded,
}
: null;

View file

@ -82,8 +82,8 @@ export function ScenarioFinancialDrawer({
bg="bg-slate-200/40"
/>
<Metric
label="Net Cost per Unit"
value={`£${formatNumber(metrics.netCostPerUnit)}`}
label="Gross Cost per Unit"
value={`£${formatNumber(metrics.grossPerUnit)}`}
icon={Home}
color="text-sky-600"
bg="bg-sky-200/40"

View file

@ -156,7 +156,13 @@ export async function getCountByPropertyType(
export async function getExpiredEpcCount(portfolioId: number): Promise<number> {
const result = await db.execute<{ expired: number }>(sql`
SELECT
SUM(CASE WHEN is_expired = true THEN 1 ELSE 0 END)::int AS expired
SUM(
CASE
WHEN is_expired = true AND estimated = false
THEN 1
ELSE 0
END
)::int AS expired
FROM property_details_epc
WHERE portfolio_id = ${portfolioId};
`);