migrated database to rename adjusted energy consumption to current energy demand

This commit is contained in:
Khalim Conn-Kowlessar 2024-08-13 17:23:54 +01:00
parent fd6be9a790
commit 3c9b8b0ce5
8 changed files with 2818 additions and 8 deletions

View file

@ -34,7 +34,7 @@ export async function GET(
with: {
detailsEpc: {
columns: {
adjustedEnergyConsumption: true,
currentEnergyDemand: true,
co2Emissions: true,
estimated: true,
},

View file

@ -0,0 +1 @@
ALTER TABLE "property_details_epc" RENAME COLUMN "adjusted_energy_consumption" TO "current_energy_demand";

File diff suppressed because it is too large Load diff

View file

@ -624,6 +624,13 @@
"when": 1722373333782,
"tag": "0088_many_tana_nile",
"breakpoints": true
},
{
"idx": 89,
"version": "5",
"when": 1723565509020,
"tag": "0089_superb_johnny_blaze",
"breakpoints": true
}
]
}

View file

@ -33,7 +33,7 @@ export interface PropertyMeta {
currentSapPoints: number;
updatedAt: string;
detailsEpc: {
adjustedEnergyConsumption: number | null;
currentEnergyDemand: number | null;
co2Emissions: number | null;
estimated: boolean;
};
@ -170,7 +170,7 @@ export const propertyDetailsEpc = pgTable("property_details_epc", {
energyTariff: text("energy_tariff"),
primaryEnergyConsumption: real("primary_energy_consumption"),
co2Emissions: real("co2_emissions"),
adjustedEnergyConsumption: real("adjusted_energy_consumption"),
currentEnergyDemand: real("current_energy_demand"),
estimated: boolean("estimated").default(false),
});

View file

@ -27,7 +27,7 @@ export default async function BuildingPassportHome({
<EpcCard
epcRating={propertyMeta.currentEpcRating}
fullMargin={false}
kwh={propertyMeta.detailsEpc.adjustedEnergyConsumption}
kwh={propertyMeta.detailsEpc.currentEnergyDemand}
carbon={propertyMeta.detailsEpc.co2Emissions}
/>
<div className="flex flex-col p-8 bg-white shadow rounded-md max-w-2xl mx-auto justify-start text-gray-700">

View file

@ -292,8 +292,8 @@ export function formatHeatDemandFeatures(
return [
{
feature: "Estimated energy consumption",
description: conditionReportData.adjustedEnergyConsumption
? `${conditionReportData.adjustedEnergyConsumption.toFixed(0)} kWh/year`
description: conditionReportData.currentEnergyDemand
? `${conditionReportData.currentEnergyDemand.toFixed(0)} kWh/year`
: "Unknown",
},
{

View file

@ -1,8 +1,8 @@
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"target": "es5",
// "target": "ESNext",
// "target": "es5",
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,