mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Merge pull request #147 from Hestia-Homes/new-reporting
changed net cost to gross
This commit is contained in:
commit
d863433d8d
4 changed files with 11 additions and 5 deletions
|
|
@ -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,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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};
|
||||
`);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue