mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-08 11:37:25 +00:00
Added heating controls and fixed saveChanges() function inside recommendation card modal to use the adjusted heat demand instead of the regular
This commit is contained in:
parent
db1c203739
commit
fd302e07e4
5 changed files with 19 additions and 2 deletions
|
|
@ -35,6 +35,7 @@ const TitleMap = {
|
|||
solar_pv: "Solar Photovoltaic Panels System",
|
||||
// Heating
|
||||
heating: "Heating Systems",
|
||||
heating_control: "Heating Controls",
|
||||
// Hot water tank
|
||||
hot_water_tank_insulation: "Hot Water Tank Insulation",
|
||||
// Default options when no recommendation is selected
|
||||
|
|
|
|||
|
|
@ -107,6 +107,11 @@ export default function RecommendationContainer({
|
|||
(rec: Recommendation) => rec.default
|
||||
) || emptyImpactState;
|
||||
|
||||
const defaultHeatingControlRecommendations =
|
||||
categorizedRecommendations.heating_control?.find(
|
||||
(rec: Recommendation) => rec.default
|
||||
) || emptyImpactState;
|
||||
|
||||
const defaultHotWaterTankRecommendations =
|
||||
categorizedRecommendations.hot_water_tank_insulation?.find(
|
||||
(rec: Recommendation) => rec.default
|
||||
|
|
@ -125,6 +130,7 @@ export default function RecommendationContainer({
|
|||
heating: defaultHeatingRecommendations.estimatedCost || 0,
|
||||
hot_water_tank_insulation:
|
||||
defaultHotWaterTankRecommendations.estimatedCost || 0,
|
||||
heating_control: defaultHeatingControlRecommendations.estimatedCost || 0,
|
||||
});
|
||||
|
||||
const [sapMap, setSapMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -139,6 +145,7 @@ export default function RecommendationContainer({
|
|||
heating: defaultHeatingRecommendations.sapPoints || 0,
|
||||
hot_water_tank_insulation:
|
||||
defaultHotWaterTankRecommendations.sapPoints || 0,
|
||||
heating_control: defaultHeatingControlRecommendations.sapPoints || 0,
|
||||
});
|
||||
|
||||
const [labourDaysMap, setLabourDaysMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -153,6 +160,7 @@ export default function RecommendationContainer({
|
|||
heating: defaultHeatingRecommendations.labourDays || 0,
|
||||
hot_water_tank_insulation:
|
||||
defaultHotWaterTankRecommendations.labourDays || 0,
|
||||
heating_control: defaultHeatingControlRecommendations.labourDays || 0,
|
||||
});
|
||||
|
||||
const [co2SavingsMap, setCo2SavingsMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -170,6 +178,8 @@ export default function RecommendationContainer({
|
|||
heating: defaultHeatingRecommendations.co2EquivalentSavings || 0,
|
||||
hot_water_tank_insulation:
|
||||
defaultHotWaterTankRecommendations.co2EquivalentSavings || 0,
|
||||
heating_control:
|
||||
defaultHeatingControlRecommendations.co2EquivalentSavings || 0,
|
||||
});
|
||||
|
||||
const [energyCostSavingsMap, setEnergyCostSavingsMap] =
|
||||
|
|
@ -188,6 +198,8 @@ export default function RecommendationContainer({
|
|||
heating: defaultHeatingRecommendations.energyCostSavings || 0,
|
||||
hot_water_tank_insulation:
|
||||
defaultHotWaterTankRecommendations.energyCostSavings || 0,
|
||||
heating_control:
|
||||
defaultHeatingControlRecommendations.energyCostSavings || 0,
|
||||
});
|
||||
|
||||
const [heatDemandMap, setHeatDemandMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -204,6 +216,8 @@ export default function RecommendationContainer({
|
|||
heating: defaultHeatingRecommendations.adjustedHeatDemand || 0,
|
||||
hot_water_tank_insulation:
|
||||
defaultHotWaterTankRecommendations.adjustedHeatDemand || 0,
|
||||
heating_control:
|
||||
defaultHeatingControlRecommendations.adjustedHeatDemand || 0,
|
||||
});
|
||||
|
||||
const [totalEstimatedCost, setTotalEstimatedCost] = useState(
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ export default function RecommendationModal({
|
|||
// Update the heat demand savings map
|
||||
const newHeatDemandMap = {
|
||||
...heatDemandMap,
|
||||
[title]: recommendationData[newIndex]?.heatDemand || 0,
|
||||
[title]: recommendationData[newIndex]?.adjustedHeatDemand || 0,
|
||||
};
|
||||
|
||||
setHeatDemandMap(newHeatDemandMap);
|
||||
|
|
|
|||
|
|
@ -121,7 +121,8 @@ export type RecommendationType =
|
|||
| "floor_insulation"
|
||||
| "solar_pv"
|
||||
| "heating"
|
||||
| "hot_water_tank_insulation";
|
||||
| "hot_water_tank_insulation"
|
||||
| "heating_control";
|
||||
|
||||
export type UnnestedRecommendation = {
|
||||
quantity: number;
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@ export interface RecommendationMetricMap {
|
|||
solar_pv: number;
|
||||
heating: number;
|
||||
hot_water_tank_insulation: number;
|
||||
heating_control: number;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue