diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-08-18 13:50:51 +0300 |
commit | db384e6b19af03b4c3c82a5760d83a3fd79f7982 (patch) | |
tree | 34beaef37df5f47ccbcf5729d7583aae093cffa0 /app/services/boards/base_items_list_service.rb | |
parent | 54fd7b1bad233e3944434da91d257fa7f63c3996 (diff) |
Add latest changes from gitlab-org/gitlab@16-3-stable-eev16.3.0-rc42
Diffstat (limited to 'app/services/boards/base_items_list_service.rb')
-rw-r--r-- | app/services/boards/base_items_list_service.rb | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/app/services/boards/base_items_list_service.rb b/app/services/boards/base_items_list_service.rb index a4b1be1e599..7c8846d2fe8 100644 --- a/app/services/boards/base_items_list_service.rb +++ b/app/services/boards/base_items_list_service.rb @@ -13,17 +13,16 @@ module Boards # rubocop: disable CodeReuse/ActiveRecord def metadata(required_fields = [:issue_count, :total_issue_weight]) - # Failing tests in spec/requests/api/graphql/boards/board_lists_query_spec.rb - ::Gitlab::Database.allow_cross_joins_across_databases(url: "https://gitlab.com/gitlab-org/gitlab/-/issues/417465") do - fields = metadata_fields(required_fields) - keys = fields.keys - # TODO: eliminate need for SQL literal fragment - columns = Arel.sql(fields.values_at(*keys).join(', ')) - results = item_model.where(id: collection_ids) - results = results.select(columns) - - Hash[keys.zip(results.pluck(columns).flatten)] - end + fields = metadata_fields(required_fields) + keys = fields.keys + columns = fields.values_at(*keys) + + results = item_model + .where(id: collection_ids) + .pluck(*columns) + .flatten + + Hash[keys.zip(results)] end # rubocop: enable CodeReuse/ActiveRecord @@ -34,7 +33,7 @@ module Boards end def metadata_fields(required_fields) - required_fields&.include?(:issue_count) ? { size: 'COUNT(*)' } : {} + required_fields&.include?(:issue_count) ? { size: Arel.sql('COUNT(*)') } : {} end def order(items) |