diff --git a/src/app/components/building-passport/RecommendationCard.tsx b/src/app/components/building-passport/RecommendationCard.tsx
index f04b8973..fb06508b 100644
--- a/src/app/components/building-passport/RecommendationCard.tsx
+++ b/src/app/components/building-passport/RecommendationCard.tsx
@@ -199,6 +199,12 @@ export default function RecommendationCard({
{cardComponent.newUValue} |
)}
+ {cardComponent.sapPoints && (
+
+ | SAP Points: |
+ {cardComponent.sapPoints} |
+
+ )}
rec.default
+ ) || { estimatedCost: 0, sapPoints: 0 };
+
+ const defaultFloorRecommendations = recommendations.Floor?.find(
+ (rec: ComponentRecommendation) => rec.default
+ ) || { estimatedCost: 0, sapPoints: 0 };
+
+ const defaultVentiliationRecommendations = recommendations.Ventilation?.find(
+ (rec: ComponentRecommendation) => rec.default
+ ) || { estimatedCost: 0, sapPoints: 0 };
+
+ const totalEstimatedCost =
+ (defaultWallsRecommendations.estimatedCost || 0) +
+ (defaultFloorRecommendations.estimatedCost || 0) +
+ (defaultVentiliationRecommendations.estimatedCost || 0);
+
+ const totalSapPoints =
+ (defaultWallsRecommendations.sapPoints || 0) +
+ (defaultFloorRecommendations.sapPoints || 0) +
+ (defaultVentiliationRecommendations.sapPoints || 0);
+
+ const currentEpcRating = propertyMeta.currentEpcRating;
+ const currentSapPoints = propertyMeta.currentSapPoints;
+
+ const expectedSapPoints = currentSapPoints + totalSapPoints;
+ const expectedEpcRating = sapToEpc(expectedSapPoints);
+
return (
Recommendations
+
+
+
+
+
+ | Total Cost: |
+ {"£" + formatNumber(totalEstimatedCost)} |
+
+
+
+ |
+ Total SAP Points Improvement:
+ |
+ {totalSapPoints} |
+
+
+
+
+
+
+
+ | Current EPC Rating: |
+ {currentEpcRating} |
+
+
+
+ | Expected EPC Rating: |
+ {expectedEpcRating} |
+
+
+
+
{Object.entries(recommendations).map(
([componentType, recommendationData], idx) => {
diff --git a/src/app/utils.ts b/src/app/utils.ts
index 7c710755..1468ab83 100644
--- a/src/app/utils.ts
+++ b/src/app/utils.ts
@@ -1,3 +1,25 @@
+export function sapToEpc(sapPoints: number): string {
+ if (sapPoints <= 0 || sapPoints > 100) {
+ throw new Error("SAP points should be between 1 and 100.");
+ }
+
+ if (sapPoints > 91) {
+ return "A";
+ } else if (sapPoints > 80) {
+ return "B";
+ } else if (sapPoints > 69) {
+ return "C";
+ } else if (sapPoints > 55) {
+ return "D";
+ } else if (sapPoints > 39) {
+ return "E";
+ } else if (sapPoints > 21) {
+ return "F";
+ } else {
+ return "G";
+ }
+}
+
export function formatDateTime(dateTimeString: string): string {
// Create a new Date object
const dateTime = new Date(dateTimeString);