Skip to content

Commit

Permalink
fix: changing strategy in roi panel
Browse files Browse the repository at this point in the history
  • Loading branch information
sedghi committed May 31, 2022
1 parent af5b44f commit 5a5a180
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,25 @@ const WEIGHT_DEFAULT = 0.41;
const DEFAULT_STRATEGY = ROI_STAT;

function reducer(state, action) {
const { payload } = action;
const { strategy, lower, upper, weight } = payload;

switch (action.type) {
case 'setStrategy':
return {
...state,
strategy: action.strategy,
strategy,
};
case 'setThreshold':
return {
...state,
lower: action.lower ? action.lower : state.lower,
upper: action.upper ? action.upper : state.upper,
lower: lower ? lower : state.lower,
upper: upper ? upper : state.upper,
};
case 'setWeight':
return {
...state,
weight: action.weight,
weight,
};
default:
return state;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ export const ROI_STAT = 'roi_stat';
const RANGE = 'range';

const options = [
{ value: ROI_STAT, label: 'Percentage of Max Value', placeHolder: ['Max'] },
{ value: RANGE, label: 'Range Threshold', placeHolder: ['Range'] },
{ value: ROI_STAT, label: 'Max', placeHolder: 'Max' },
{ value: RANGE, label: 'Range', placeHolder: 'Range' },
];

function ROIThresholdConfiguration({ config, dispatch, runCommand }) {
Expand All @@ -29,7 +29,7 @@ function ROIThresholdConfiguration({ config, dispatch, runCommand }) {
value={config.strategy}
onChange={({ value }) => {
dispatch({
type: 'setConfig',
type: 'setStrategy',
payload: {
strategy: value,
},
Expand Down

0 comments on commit 5a5a180

Please sign in to comment.