Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove unnecessary
includes
in requests query
Sorting the requests by the Source, Target or Type columns led to missing results. This was caused by a wrong DISTINCT clause, that was taking fields from two tables (`bs_request_actions` and `requests`) instead of one (`requests`). Those extra fields in the DISTINCT clause were introduced by an `includes` finder method. The problem was fixed by replacing the `includes` in the `.with_action` scope with a `joins` finder method, so the fields from `bs_requests_actions` are no longer part of the DISTINCT modifier in the SQL sentence. Additionally, the `includes` in the BsRequest::DataTable::FindForUserOrGroup#requests method was redundant. We add `preload(:bs_request_actions)` instead. In order to prevent using LIMIT inside subqueries, we moved the limit finder method to the last step of the query. Co-authored-by: Saray Cabrera Padrón <scabrerapadron@suse.de>
- Loading branch information