Skip to content

Commit

Permalink
Removed School Safety Campaign Strategy from rules (#1752)
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Jun 20, 2024
1 parent eaad9b0 commit e3eacf1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
12 changes: 7 additions & 5 deletions client/src/components/ProjectWizard/TdmCalculationContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,18 @@ export function TdmCalculationContainer({ contentContainerRef }) {
const strategyBike4 = rules.find(r => r.code === "STRATEGY_BIKE_4");
const strategyHov4 = rules.find(r => r.code === "STRATEGY_HOV_4");
const strategyInfo3 = rules.find(r => r.code === "STRATEGY_INFO_3");
const strategyInfo5 = rules.find(r => r.code === "STRATEGY_INFO_5");
const strategyMobilityInvestment2 = rules.find(
r => r.code === "STRATEGY_MOBILITY_INVESTMENT_2"
);
return (
strategyBike4 &&
!!strategyBike4.value &&
strategyHov4 &&
!!strategyHov4.value &&
strategyInfo3 &&
strategyInfo3.value >= 2 &&
strategyInfo5 &&
!!strategyInfo5.value
strategyMobilityInvestment2 &&
strategyMobilityInvestment2.value >= 2
);
};

Expand Down Expand Up @@ -211,7 +213,7 @@ export function TdmCalculationContainer({ contentContainerRef }) {
if (rules.find(r => r.code === "STRATEGY_INFO_3").value <= 1) {
modifiedInputs["STRATEGY_INFO_3"] = 2;
}
modifiedInputs["STRATEGY_INFO_5"] = true;
modifiedInputs["STRATEGY_MOBILITY_INVESTMENT_2"] = 2;
modifiedInputs["STRATEGY_HOV_4"] = true;

// De-select Trip-Reduction Program
Expand All @@ -225,7 +227,7 @@ export function TdmCalculationContainer({ contentContainerRef }) {
} else {
modifiedInputs["STRATEGY_INFO_3"] = 1;
}
modifiedInputs["STRATEGY_INFO_5"] = false;
modifiedInputs["STRATEGY_MOBILITY_INVESTMENT_2"] = 0;
modifiedInputs["STRATEGY_HOV_4"] = false;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
if exists (SELECT * from calculationrule where calculationid = 1 and code = 'STRATEGY_INFO_5')
begin
delete calculationrule where calculationid = 1 and code = 'STRATEGY_INFO_5';
end

if exists (SELECT * from calculationrule where calculationid = 1 and code = 'PTS_INFO_5')

begin
delete calculationrule where calculationid = 1 and code = 'PTS_INFO_5';
end

update calculationrule set
functionBody = ' return (<<PROJECT_LEVEL>> === 1 && !!<<STRATEGY_BIKE_4>> && <<STRATEGY_HOV_4>> && (<<STRATEGY_MOBILITY_INVESTMENT_2>> >= 2) && !!(<<STRATEGY_INFO_3>> >= 2)) ? 1 : 0; '
where calculationid = 1 and code = 'PTS_PKG_SCHOOL'

update calculationrule set
functionBody = 'return <<PTS_INFO_1>> + <<PTS_INFO_2>> + <<PTS_INFO_3>>;'
where calculationid = 1 and code = 'PTS_INFO'

0 comments on commit e3eacf1

Please sign in to comment.