Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DT-781: Use logical AND to combine filters in the DUOS UI #2715

Merged
merged 3 commits into from
Nov 7, 2024

Conversation

pshapiro4broad
Copy link
Member

@pshapiro4broad pshapiro4broad commented Nov 6, 2024

Addresses

https://broadworkbench.atlassian.net/browse/DT-781

Users would like filters in the DUOS UI to combine as a set intersection operation, so an item is only shown if it's valid for all selected filters.

Summary

By changing the root node of filter query to use must instead of should, the filters are combined using logical AND instead of OR.

Video of feature in action

filter.mov

…lso combine some common code to avoid duplication
@pshapiro4broad pshapiro4broad requested a review from a team as a code owner November 6, 2024 19:10
@pshapiro4broad pshapiro4broad requested review from rjohanek and cinyecai and removed request for a team November 6, 2024 19:10
@@ -104,60 +104,48 @@ export const DatasetSearchTable = (props) => {
queryChunks.push(...searchModifier);
}

var filterQuery = {};
let filterQuery = {};
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think var is not recommended now that we have let and const. The difference is that var has function scope, whereas let and const have block scope, which is usually what you want.

'bool': {
'must': queryChunks
}
return {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change wasn't required, but I thought it would be nice to

  • combine the code fragments to avoid duplication
  • test filterQuery instead of recomputing numSelectedFilters(filters), since filterQuery is the value actually used in the code block

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See below:

Copy link
Contributor

@rushtong rushtong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

Copy link
Contributor

@fboulnois fboulnois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, thank you! 👍

@pshapiro4broad pshapiro4broad merged commit e5e60a1 into develop Nov 7, 2024
9 checks passed
@pshapiro4broad pshapiro4broad deleted the ps/dt-781-use-logical-and-for-filters branch November 7, 2024 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants