From f70c092f335be599645484078c1bc08411ff5a91 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Mon, 15 Apr 2024 23:56:11 +0100 Subject: [PATCH] Added new columns to db for summary page --- .../portfolio/summary/SummaryTable.tsx | 4 ++++ src/app/db/migrations/meta/_journal.json | 7 +++++++ src/app/db/schema/portfolio.ts | 18 ++++++++++++++++++ .../[slug]/(portfolio)/summary/page.tsx | 9 ++++++++- 4 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/app/components/portfolio/summary/SummaryTable.tsx b/src/app/components/portfolio/summary/SummaryTable.tsx index 94621d1c..40e21dd2 100644 --- a/src/app/components/portfolio/summary/SummaryTable.tsx +++ b/src/app/components/portfolio/summary/SummaryTable.tsx @@ -131,6 +131,10 @@ const SummaryTable = ({ title: "Cost", scenarios: [{ scenarioName: "EPC B Scenario", data: "£32,412" }], }, + { + title: "Cost (£) /unit", + scenarios: [{ scenarioName: "EPC B Scenario", data: "£1,412" }], + }, { title: "£ per CO2 reduction", scenarios: [{ scenarioName: "EPC B Scenario", data: "£50" }], diff --git a/src/app/db/migrations/meta/_journal.json b/src/app/db/migrations/meta/_journal.json index 5bcf3bc2..e96eda7c 100644 --- a/src/app/db/migrations/meta/_journal.json +++ b/src/app/db/migrations/meta/_journal.json @@ -470,6 +470,13 @@ "when": 1713102595793, "tag": "0066_eager_cerise", "breakpoints": true + }, + { + "idx": 67, + "version": "5", + "when": 1713221740366, + "tag": "0067_previous_sasquatch", + "breakpoints": true } ] } \ No newline at end of file diff --git a/src/app/db/schema/portfolio.ts b/src/app/db/schema/portfolio.ts index d605b522..f1fd2020 100644 --- a/src/app/db/schema/portfolio.ts +++ b/src/app/db/schema/portfolio.ts @@ -69,6 +69,24 @@ export const portfolio = pgTable("portfolio", { }) .defaultNow() .notNull(), + // Aggregates added for the summary tab + epcBreakdownPreRetrofit: text("epc_breakdown_pre_retrofit"), + epcBreakdownPostRetrofit: text("epc_breakdown_post_retrofit"), + nUnitsToRetrofit: integer("n_units_to_retrofit"), + co2PerUnitPreRetrofit: text("co2_per_unit_pre_retrofit"), + co2PerUnitPostRetrofit: text("co2_per_unit_post_retrofit"), + energyBillPerUnitPreRetrofit: text("energy_bill_per_unit_pre_retrofit"), + energyBillPerUnitPostRetrofit: text("energy_bill_per_unit_post_retrofit"), + energyConsumptionPerUnitPreRetrofit: text( + "energy_consumption_per_unit_pre_retrofit" + ), + energyConsumptionPerUnitPostRetrofit: text( + "energy_consumption_per_unit_post_retrofit" + ), + valuationImprovementPerUnit: text("valuation_improvement_per_unit"), + costPerUnit: text("cost_per_unit"), + costPerCo2Saved: text("cost_per_co2_saved"), + costPerSapPoint: text("cost_per_sap_point"), }); export const portfolioUsers = pgTable("portfolioUsers", { diff --git a/src/app/portfolio/[slug]/(portfolio)/summary/page.tsx b/src/app/portfolio/[slug]/(portfolio)/summary/page.tsx index 481dc334..ed5f2b8a 100644 --- a/src/app/portfolio/[slug]/(portfolio)/summary/page.tsx +++ b/src/app/portfolio/[slug]/(portfolio)/summary/page.tsx @@ -68,7 +68,14 @@ export default async function PortfolioSummary({ ], }, { - title: "Cost", + title: "Cost (£)", + scenarios: [ + { scenarioName: "Today", data: "" }, + { scenarioName: "Projected", data: "£32,412" }, + ], + }, + { + title: "Cost (£) /unit", scenarios: [ { scenarioName: "Today", data: "" }, { scenarioName: "Projected", data: "£32,412" },