ensuring we adjust bills

This commit is contained in:
Khalim Conn-Kowlessar 2026-01-07 22:57:44 +00:00
parent 94e431680b
commit b1ae529294

View file

@ -35,7 +35,8 @@ export async function getAverages(
e.lighting_cost_current +
e.appliances_cost_current +
e.gas_standing_charge +
e.electricity_standing_charge
e.electricity_standing_charge -
COALESCE(e.installed_measures_total_energy_bill_adjustment, 0)
)::float AS avg_bills,
AVG(e.primary_energy_consumption)::float AS avg_energy_consumption
FROM property p
@ -56,7 +57,8 @@ export async function getTotals(portfolioId: number): Promise<TotalMetrics> {
e.lighting_cost_current +
e.appliances_cost_current +
e.gas_standing_charge +
e.electricity_standing_charge
e.electricity_standing_charge -
COALESCE(e.installed_measures_total_energy_bill_adjustment, 0)
)::float AS total_bills
FROM property p
LEFT JOIN property_details_epc e ON e.property_id = p.id