From 89a80911033e3e98218f954a6690cdaad2f6c93f Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Wed, 2 Aug 2023 18:20:39 +0100 Subject: [PATCH] added basic heating demand table and adding main fuel to existing property features --- .../pre-assessment-report/page.tsx | 150 +----------------- .../building-passport/[propertyId]/utils.ts | 69 ++++++-- src/app/utils.ts | 2 +- 3 files changed, 66 insertions(+), 155 deletions(-) diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx b/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx index e930468f..607881f5 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/pre-assessment-report/page.tsx @@ -12,6 +12,7 @@ import { } from "@/app/components/building-passport/FeatureTableColumns"; import { formatGeneralFeatures, + formatHeatDemandFeatures, formatRetrofitFeatures, getConditionReport, getPropertyMeta, @@ -121,149 +122,6 @@ export default async function PreAssessmentReport({ const propertyDetailsSpatial = { inConservationArea: "No", }; - console.log("DATA!!"); - console.log(conditionReportData); - - // const conditionReportData: ConditionReportData = { - // id: 1, - // lastUpdated: "2023-07-12 11:51:31.000 +0100", - // fullAddress: "123 Fake Street, Fake Town", - // postcode: "AB1 2CD", - // currentEpcRating: "C", - // inConservationArea: "Yes", - // propertyType: "House", - // builtForm: "Detached", - // totalFloorArea: 60, - // tenure: "Rented (social)", - // yearBuilt: "1990", - // retrofitFeatures: [ - // { feature: "Wall", description: "Cavity wall", rating: "Poor" }, - // { - // feature: "Roof", - // description: "Flat, limited insulation (assumed)", - // rating: "Very poor", - // }, - // { feature: "Windows", description: "Double glazing", rating: "Good" }, - // { feature: "Heating", description: "Gas boiler", rating: "Good" }, - // { - // feature: "Heating Control", - // description: "Programmer and appliance thermostats", - // rating: "Good", - // }, - // { - // feature: "Hot Water", - // description: "Electric immersion, standard tariff", - // rating: "Good", - // }, - // { - // feature: "Lighting", - // description: "Low energy lighting in all fixed outlets", - // rating: "Very good", - // }, - // { - // feature: "Floor", - // description: "Suspended timber", - // rating: "Poor", - // }, - // { - // feature: "Ventilation", - // description: "Natural", - // rating: "N/A", - // }, - // { - // feature: "Solar Photo Voltaic", - // description: "Not present in the property", - // rating: "N/A", - // }, - // { - // feature: "Solar Hot Water", - // description: "Heating is not solar powered", - // rating: "N/A", - // }, - // { - // feature: "Wind Turbines", - // description: "No wind turbines present", - // rating: "N/A", - // }, - // ], - // generalFeatures: [ - // { - // feature: "Floor Height", - // description: 2.4, - // }, - // { - // feature: "Number of heated rooms", - // description: 5, - // }, - // { - // feature: "Heat loss corridor", - // description: "No", - // }, - // { - // feature: "Heat loss corridor length", - // description: 0, - // }, - // { - // feature: "Number of open fire places", - // description: 0, - // }, - // { - // feature: "Number of extensions", - // description: 0, - // }, - // { - // feature: "Floor level", - // description: "Ground", - // }, - // { - // feature: "Number of storeys", - // description: 2, - // }, - // { - // feature: "Mains gas available", - // description: "Yes", - // }, - // { - // feature: "Energy tariff", - // description: "Standard", - // }, - // ], - // heatingDemand: [ - // { - // feature: "EPC primary energy consumption", - // description: "98 kWh/m2/year", - // }, - // { - // feature: "EPC CO2 emissions", - // description: "2.8 tonnes/year", - // }, - // { - // feature: "Elecrticity Supplier", - // description: "E.ON Energy", - // }, - // { - // feature: "Gas Supplier", - // description: "British Gas", - // }, - // { - // feature: "Meter reading total energy consumption", - // description: "108 kWh/m2/year", - // }, - // { - // feature: "Meter reading electicity consumption", - // description: "22 kWh/m2/year", - // }, - // { - // feature: "Meter reading gas consumption", - // description: "86 kWh/m2/year", - // }, - // ], - // }; - - // const retrofitFeatures = conditionReportData.retrofitFeatures; - // const generalFeatures = conditionReportData.generalFeatures; - // const heatingDemand = conditionReportData.heatingDemand; - const generalFeatures = formatGeneralFeatures( conditionReportData, propertyMeta.propertyType @@ -271,6 +129,8 @@ export default async function PreAssessmentReport({ const retrofitFeatures = formatRetrofitFeatures(conditionReportData); + const heatingDemand = formatHeatDemandFeatures(conditionReportData); + return (
Pre Assessment Report
@@ -296,8 +156,8 @@ export default async function PreAssessmentReport({
Existing Property Features
- {/*
Heating Demand
- */} +
Heating Demand
+
); } diff --git a/src/app/portfolio/[slug]/building-passport/[propertyId]/utils.ts b/src/app/portfolio/[slug]/building-passport/[propertyId]/utils.ts index ffa4d288..2cb729c8 100644 --- a/src/app/portfolio/[slug]/building-passport/[propertyId]/utils.ts +++ b/src/app/portfolio/[slug]/building-passport/[propertyId]/utils.ts @@ -103,47 +103,52 @@ export function formatRetrofitFeatures( const retrofitFeatures: Feature[] = [ { feature: "Wall", - description: conditionReportData.walls || "N/A", + description: conditionReportData.walls || "unknown", rating: getRating(conditionReportData.wallsRating), }, { feature: "Roof", - description: conditionReportData.roof || "N/A", + description: conditionReportData.roof || "unknown", rating: getRating(conditionReportData.roofRating), }, { feature: "Windows", - description: conditionReportData.windows || "N/A", + description: conditionReportData.windows || "unknown", rating: getRating(conditionReportData.windowsRating), }, { feature: "Heating", - description: conditionReportData.heating || "N/A", + description: conditionReportData.heating || "unknown", rating: getRating(conditionReportData.heatingRating), }, { feature: "Heating Control", - description: conditionReportData.heatingControls || "N/A", + description: conditionReportData.heatingControls || "unknown", rating: getRating(conditionReportData.heatingControlsRating), }, { feature: "Hot Water", - description: conditionReportData.hotWater || "N/A", + description: conditionReportData.hotWater || "unknown", rating: getRating(conditionReportData.hotWaterRating), }, { feature: "Lighting", - description: conditionReportData.lighting || "N/A", + description: conditionReportData.lighting || "unknown", rating: getRating(conditionReportData.lightingRating), }, { feature: "Floor", - description: conditionReportData.floor || "N/A", + description: conditionReportData.floor || "unknown", rating: getRating(conditionReportData.floorRating), }, { feature: "Ventilation", - description: conditionReportData.ventilation || "N/A", + description: conditionReportData.ventilation || "unknown", + rating: "N/A", + }, + { + feature: "Main Fuel", + description: conditionReportData.mainfuel || "unknown", rating: "N/A", }, { @@ -173,3 +178,49 @@ export function formatRetrofitFeatures( return retrofitFeatures; } + +export function formatHeatDemandFeatures( + conditionReportData: PropertyDetailsEpc +): GeneralFeature[] { + return [ + { + feature: "EPC primary energy consumption", + description: conditionReportData.primaryEnergyConsumption + ? `${conditionReportData.primaryEnergyConsumption} kWh/m2/year` + : "unknown", + }, + { + feature: "EPC CO2 emissions", + description: conditionReportData.co2Emissions + ? `${conditionReportData.co2Emissions} tonnes/year` + : "unknown", + }, + // These features haven't been implemented yet + // { + // feature: "Electricity Supplier", + // description: conditionReportData.electricitySupplier || "unknown", + // }, + // { + // feature: "Gas Supplier", + // description: conditionReportData.gasSupplier || "unknown", + // }, + // { + // feature: "Meter reading total energy consumption", + // description: conditionReportData.totalEnergyConsumption + // ? `${conditionReportData.totalEnergyConsumption} kWh/m2/year` + // : "unknown", + // }, + // { + // feature: "Meter reading electricity consumption", + // description: conditionReportData.electricityConsumption + // ? `${conditionReportData.electricityConsumption} kWh/m2/year` + // : "unknown", + // }, + // { + // feature: "Meter reading gas consumption", + // description: conditionReportData.gasConsumption + // ? `${conditionReportData.gasConsumption} kWh/m2/year` + // : "unknown", + // }, + ]; +} diff --git a/src/app/utils.ts b/src/app/utils.ts index 4196bf18..35c5c64d 100644 --- a/src/app/utils.ts +++ b/src/app/utils.ts @@ -17,7 +17,7 @@ export const getRating = (rating: number | null): Rating => { 5: "Very good", }; - return ratingMap[rating as 1 | 2 | 3 | 4 | 5]; // You can assert that rating is one of these values since you've already checked it + return ratingMap[rating as 1 | 2 | 3 | 4 | 5] as Rating; // You can assert that rating is one of these values since you've already checked it }; export const serializeBigInt = (_: any, value: any): string | any => {