Skip to content

Commit

Permalink
Merge pull request #5 from UCD-GW-Nitrate/develop
Browse files Browse the repository at this point in the history
feat(step1): add porosity
  • Loading branch information
canewton authored Oct 1, 2024
2 parents 929d5a9 + ae714b5 commit 55a0a8b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/steps/Step1/Step1.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
setModelSimEndYear,
setModelUnsatScenario,
setModelWaterContent,
setModelPorosity,
setModelWelltypeScenario,
} from '@/store/slices/modelSlice';

Expand Down Expand Up @@ -67,6 +68,7 @@ const Step1 = ({ onNext }: StepBase) => {
dispatch(setModelWelltypeScenario(scenarios[data.welltype_scenario]!));
dispatch(setModelUnsatScenario(scenarios[data.unsat_scenario]!));
dispatch(setModelWaterContent(Math.floor(data.water_content) / 100));
dispatch(setModelPorosity(Math.floor(data.porosity / 10) / 10));
dispatch(setModelSimEndYear((data.sim_end_year as dayjs.Dayjs).year()));
dispatch(
setModelReductionStartYear(
Expand Down Expand Up @@ -119,6 +121,14 @@ const Step1 = ({ onNext }: StepBase) => {
))}
</Select>
</Form.Item>
<Form.Item
name="porosity"
label="Porosity"
rules={defaultRules('Please enter porosity')}
initialValue={model.porosity ? model.porosity * 100 : 10}
>
<InputNumber min={10} max={100} step={10} keyboard={false} formatter={(v) => `${Math.floor((v ?? 10) / 10) * 10}%`} />
</Form.Item>
<Form.Item
name="load_scenario"
label="Load scenario"
Expand Down Expand Up @@ -148,7 +158,7 @@ const Step1 = ({ onNext }: StepBase) => {
>
<Select>
{welltypeScenarioOptions.map((scen) => (
<Select.Option value={scen.id} key={scen.id}>
<Select.Option value={scen.id} key={scen.id} disabled={scen.id == 14}>
<>
{scen.name}{' '}
{scen.description ? (
Expand Down
1 change: 1 addition & 0 deletions src/store/apis/modelApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ const modelApi = createApi({
name: params.name,
description: params.description,
water_content: params.water_content,
porosity: params.porosity,
sim_end_year: params.sim_end_year,
reduction_start_year: params.reduction_start_year,
reduction_end_year: params.reduction_end_year,
Expand Down
4 changes: 4 additions & 0 deletions src/store/slices/modelSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ const modelSlice = createSlice({
setModelWaterContent(state, action: PayloadAction<number>) {
return { ...state, water_content: action.payload };
},
setModelPorosity(state, action: PayloadAction<number>) {
return { ...state, porosity: action.payload };
},
setModelSimEndYear(state, action: PayloadAction<number>) {
return { ...state, sim_end_year: action.payload };
},
Expand Down Expand Up @@ -85,6 +88,7 @@ export const {
setModelName,
setModelDescription,
setModelWaterContent,
setModelPorosity,
setModelSimEndYear,
setModelReductionStartYear,
setModelReductionEndYear,
Expand Down
1 change: 1 addition & 0 deletions src/types/model/FormModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export interface FormModel {
name?: string;
description?: string;
water_content?: number;
porosity?: number;
sim_end_year?: number;
reduction_start_year?: number;
reduction_end_year?: number;
Expand Down

0 comments on commit 55a0a8b

Please sign in to comment.