mirror of
https://github.com/Hestia-Homes/assessment-model.git
synced 2026-06-30 12:55:02 +00:00
Added valuation fields to db
This commit is contained in:
parent
b15ab97bb2
commit
f3a95e462e
11 changed files with 2990 additions and 3 deletions
|
|
@ -37,6 +37,7 @@ const TitleMap = {
|
|||
wall_insulation: "Wall Insulation",
|
||||
floor_insulation: "Floor Insulation",
|
||||
roof_insulation: "Roof Insulation",
|
||||
heating: "Heating Systems",
|
||||
};
|
||||
|
||||
type RecommendationCardProps = {
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ const typeToCategoryMap: { [key in RecommendationType]?: RecommendationType } =
|
|||
solid_floor_insulation: "floor_insulation",
|
||||
exposed_floor_insulation: "floor_insulation",
|
||||
windows_glazing: "windows_glazing",
|
||||
heating: "heating",
|
||||
};
|
||||
|
||||
const emptyImpactState = {
|
||||
|
|
@ -101,6 +102,11 @@ export default function RecommendationContainer({
|
|||
(rec: Recommendation) => rec.default
|
||||
) || emptyImpactState;
|
||||
|
||||
const defaultHeatingRecommendations =
|
||||
categorizedRecommendations.heating?.find(
|
||||
(rec: Recommendation) => rec.default
|
||||
) || emptyImpactState;
|
||||
|
||||
const [costMap, setCostMap] = useState<RecommendationMetricMap>({
|
||||
wall_insulation: defaultWallsRecommendations.estimatedCost || 0,
|
||||
floor_insulation: defaultFloorRecommendations.estimatedCost || 0,
|
||||
|
|
@ -111,6 +117,7 @@ export default function RecommendationContainer({
|
|||
low_energy_lighting: defaultLightingRecommendations.estimatedCost || 0,
|
||||
windows_glazing: defaultWindowsRecommendations.estimatedCost || 0,
|
||||
solar_pv: defaultSolarRecommendations.estimatedCost || 0,
|
||||
heating: defaultHeatingRecommendations.estimatedCost || 0,
|
||||
});
|
||||
|
||||
const [sapMap, setSapMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -122,6 +129,7 @@ export default function RecommendationContainer({
|
|||
low_energy_lighting: defaultLightingRecommendations.sapPoints || 0,
|
||||
windows_glazing: defaultWindowsRecommendations.sapPoints || 0,
|
||||
solar_pv: defaultSolarRecommendations.sapPoints || 0,
|
||||
heating: defaultHeatingRecommendations.sapPoints || 0,
|
||||
});
|
||||
|
||||
const [labourDaysMap, setLabourDaysMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -133,6 +141,7 @@ export default function RecommendationContainer({
|
|||
low_energy_lighting: defaultLightingRecommendations.labourDays || 0,
|
||||
windows_glazing: defaultWindowsRecommendations.labourDays || 0,
|
||||
solar_pv: defaultSolarRecommendations.labourDays || 0,
|
||||
heating: defaultHeatingRecommendations.labourDays || 0,
|
||||
});
|
||||
|
||||
const [co2SavingsMap, setCo2SavingsMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -147,6 +156,7 @@ export default function RecommendationContainer({
|
|||
defaultLightingRecommendations.co2EquivalentSavings || 0,
|
||||
windows_glazing: defaultWindowsRecommendations.co2EquivalentSavings || 0,
|
||||
solar_pv: defaultSolarRecommendations.co2EquivalentSavings || 0,
|
||||
heating: defaultHeatingRecommendations.co2EquivalentSavings || 0,
|
||||
});
|
||||
|
||||
const [energyCostSavingsMap, setEnergyCostSavingsMap] =
|
||||
|
|
@ -162,6 +172,7 @@ export default function RecommendationContainer({
|
|||
defaultLightingRecommendations.energyCostSavings || 0,
|
||||
windows_glazing: defaultWindowsRecommendations.energyCostSavings || 0,
|
||||
solar_pv: defaultSolarRecommendations.energyCostSavings || 0,
|
||||
heating: defaultHeatingRecommendations.energyCostSavings || 0,
|
||||
});
|
||||
|
||||
const [heatDemandMap, setHeatDemandMap] = useState<RecommendationMetricMap>({
|
||||
|
|
@ -175,6 +186,7 @@ export default function RecommendationContainer({
|
|||
low_energy_lighting: defaultLightingRecommendations.adjustedHeatDemand || 0,
|
||||
windows_glazing: defaultWindowsRecommendations.adjustedHeatDemand || 0,
|
||||
solar_pv: defaultSolarRecommendations.adjustedHeatDemand || 0,
|
||||
heating: defaultHeatingRecommendations.adjustedHeatDemand || 0,
|
||||
});
|
||||
|
||||
const [totalEstimatedCost, setTotalEstimatedCost] = useState(
|
||||
|
|
|
|||
1
src/app/db/migrations/0061_little_doctor_faustus.sql
Normal file
1
src/app/db/migrations/0061_little_doctor_faustus.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
ALTER TABLE "property" ADD COLUMN "current_valuation" real;
|
||||
3
src/app/db/migrations/0062_cute_zodiak.sql
Normal file
3
src/app/db/migrations/0062_cute_zodiak.sql
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
ALTER TABLE "plan" ADD COLUMN "valuation_increase_lower_bound" real;--> statement-breakpoint
|
||||
ALTER TABLE "plan" ADD COLUMN "valuation_increase_upper_bound" real;--> statement-breakpoint
|
||||
ALTER TABLE "plan" ADD COLUMN "valuation_increase_average" real;
|
||||
1466
src/app/db/migrations/meta/0061_snapshot.json
Normal file
1466
src/app/db/migrations/meta/0061_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
1484
src/app/db/migrations/meta/0062_snapshot.json
Normal file
1484
src/app/db/migrations/meta/0062_snapshot.json
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -428,6 +428,20 @@
|
|||
"when": 1708088000419,
|
||||
"tag": "0060_dark_wilson_fisk",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 61,
|
||||
"version": "5",
|
||||
"when": 1708535642480,
|
||||
"tag": "0061_little_doctor_faustus",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 62,
|
||||
"version": "5",
|
||||
"when": 1708536308885,
|
||||
"tag": "0062_cute_zodiak",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -110,6 +110,7 @@ export const property = pgTable("property", {
|
|||
tenure: text("tenure"),
|
||||
currentEpcRating: epcEnum("current_epc_rating"),
|
||||
currentSapPoints: real("current_sap_points"),
|
||||
currentValuation: real("current_valuation"),
|
||||
});
|
||||
|
||||
export const FeatureRating: [string, ...string[]] = [
|
||||
|
|
|
|||
|
|
@ -69,6 +69,9 @@ export const plan = pgTable("plan", {
|
|||
.references(() => property.id),
|
||||
createdAt: timestamp("created_at").notNull().defaultNow(),
|
||||
isDefault: boolean("is_default").notNull(),
|
||||
valuationIncreaseLowerBound: real("valuation_increase_lower_bound"),
|
||||
valuationIncreaseUpperBound: real("valuation_increase_upper_bound"),
|
||||
valuationIncreaseAverage: real("valuation_increase_average"),
|
||||
});
|
||||
|
||||
export const planRecommendations = pgTable("plan_recommendations", {
|
||||
|
|
@ -116,7 +119,8 @@ export type RecommendationType =
|
|||
| "roof_insulation"
|
||||
| "wall_insulation"
|
||||
| "floor_insulation"
|
||||
| "solar_pv";
|
||||
| "solar_pv"
|
||||
| "heating";
|
||||
|
||||
export type UnnestedRecommendation = {
|
||||
quantity: number;
|
||||
|
|
|
|||
|
|
@ -7,4 +7,5 @@ export interface RecommendationMetricMap {
|
|||
low_energy_lighting: number;
|
||||
windows_glazing: number;
|
||||
solar_pv: number;
|
||||
heating: number;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"target": "es5",
|
||||
// "target": "ESNext",
|
||||
// "target": "es5",
|
||||
"target": "ESNext",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue