Skip to content

Commit

Permalink
Fix min/max special case in cohort filter creation with "in the range…
Browse files Browse the repository at this point in the history
… of" (#1279)

* fix logic in the case that min or max are zero

* lintfix
  • Loading branch information
romanlutz authored and gaugup committed Apr 21, 2022
1 parent 241e168 commit 1eee58a
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,16 @@ export class CohortEditor extends React.PureComponent<
//default values for in the range operation
const meta =
this.props.jointDataset.metaDict[openedFilter.column].featureRange;
openedFilter.arg[0] = meta?.min || Number.MIN_SAFE_INTEGER;
openedFilter.arg[1] = meta?.max || Number.MAX_SAFE_INTEGER;
if (meta?.min === undefined) {
openedFilter.arg[0] = Number.MIN_SAFE_INTEGER;
} else {
openedFilter.arg[0] = meta.min;
}
if (meta?.max === undefined) {
openedFilter.arg[1] = Number.MAX_SAFE_INTEGER;
} else {
openedFilter.arg[1] = meta.max;
}
} else {
//handle switch from in the range to less than, equals etc
openedFilter.arg = openedFilter.arg.slice(0, 1);
Expand Down

0 comments on commit 1eee58a

Please sign in to comment.