fixed generalFeatures

This commit is contained in:
Khalim Conn-Kowlessar 2023-08-02 16:47:14 +01:00
parent f70ddb0f4d
commit 3d3bc6a31a

View file

@ -1,5 +1,6 @@
import { db } from "@/app/db/db";
import {
GeneralFeature,
PropertyDetailsEpc,
PropertyMeta,
propertyDetailsEpc,
@ -40,13 +41,13 @@ export async function getConditionReport(
export function formatGeneralFeatures(
conditionReportData: PropertyDetailsEpc,
propertyType: string
) {
): GeneralFeature[] {
// if a property is a flat/maisonette, we show heat loss coridoor information, otherwise we won't show it
const flatOnlyFeatures = [
{
feature: "Heat loss corridor",
description: Boolean(conditionReportData.heatLossCorridor) ? "Yes" : "No",
description: conditionReportData.heatLossCorridor ? "Yes" : "No",
},
{
feature: "Heat loss corridor length",
@ -59,7 +60,7 @@ export function formatGeneralFeatures(
},
];
const generealFeatures = [
const generealFeatures: GeneralFeature[] = [
{
feature: "Floor Height",
description: conditionReportData.floorHeight || "unknown",
@ -78,11 +79,11 @@ export function formatGeneralFeatures(
},
{
feature: "Mains gas",
description: conditionReportData.mainsGas || "unknown",
description: conditionReportData.mainsGas ? "Yes" : "No",
},
{
feature: "Energy tariff",
description: conditionReportData.energyTariff,
description: conditionReportData.energyTariff || "unknown",
},
...(propertyType === "Flat" || propertyType === "Maisonette"
? flatOnlyFeatures