OBPIH-5814 Add NONE option to approvers filter #4323
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Unfortunately, the approach with the subqueries that we discussed on the tech-huddle wasn't ideal, the issue that came up was with filtering by requests with empty associations, so I decided to go with the simplest solution of querying the request ids and then querying the requests by the list of the these ids.
the approach with subqueries looks something like
The issue I mentioned came up when trying to filter by None and some other users. It did not return any requests with empty approvers because
createAlias("requisition.approvers", "approver")
by default sets the association to INNER_JOIN.When changing the jointype on Approvers to LEFT_JOIN, we face the same problem as in the beginning, of approver column missing the rest of the data (other than specified in filter approvers)
This issue started quite the discussion of the functionality/logic and UX of filtering by empty fields values, so I think we will have to come back to this discussing and come up with a final verdict.
For now I think we should follow the approach of how it is done on Purchase orders with paymentTerms filter.