Skip to content

Commit

Permalink
feat(step3): fix areapercrop error
Browse files Browse the repository at this point in the history
  • Loading branch information
canewton committed Dec 28, 2024
1 parent 694f15b commit 1fe7296
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/components/model/CropLoadingDetailsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const CropLoadingDetailsTable = ({
modelDetails.forEach((model) => {
const { modifications, name, regions } = model;
const mapType = model.regions[0]?.region_type;
const loadScenario = model.flow_scenario.scenario_type; // load_scenario type was assigned to flow_scenario, needs to be fixed
const loadScenario = model.load_scenario.id;
const cropAreas = areaPerCrop(
mapType,
loadScenario,
Expand Down
2 changes: 1 addition & 1 deletion src/components/steps/Step3/Step3.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const Step3 = ({ onPrev, onNext }: StepBase) => {
setCropAreaMap(
areaPerCrop(
model.regions![0]!.region_type,
model.flow_scenario!.scenario_type,
model.load_scenario!.id,
selectedCrops.map(
(crop) => cropDict[crop]?.caml_code ?? cropDict[crop]?.swat_code ?? 0,
),
Expand Down
1 change: 1 addition & 0 deletions src/logic/areaPerCrop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const areaPerCrop = (
): CropAreaMap => {
let areaData = GNLMcropAreas;
if (load_scenario !== 1) {
// load scenario is not GNLM
areaData = SWATcropAreas;
}

Expand Down

0 comments on commit 1fe7296

Please sign in to comment.