From 4b99614503674e3310c25f7975acba12d616cd34 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Thu, 8 Feb 2018 06:37:15 +0100 Subject: [PATCH] Revert "Fixed issue #1769 - Ticket shown multiple times in overview." This reverts commit 371a0494b7f2a59719873521b77e76c34dab3e47. --- app/models/ticket.rb | 8 ++++---- app/models/ticket/overviews.rb | 5 ++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/models/ticket.rb b/app/models/ticket.rb index e290978b2..4883e8764 100644 --- a/app/models/ticket.rb +++ b/app/models/ticket.rb @@ -424,14 +424,14 @@ get count of tickets and tickets which match on selector ActiveRecord::Base.transaction(requires_new: true) do begin if !current_user - ticket_count = Ticket.where(query, *bind_params).joins(tables).group('tickets.id').count - tickets = Ticket.where(query, *bind_params).joins(tables).group('tickets.id').limit(limit) + ticket_count = Ticket.where(query, *bind_params).joins(tables).count + tickets = Ticket.where(query, *bind_params).joins(tables).limit(limit) return [ticket_count, tickets] end access_condition = Ticket.access_condition(current_user, access) - ticket_count = Ticket.where(access_condition).where(query, *bind_params).joins(tables).group('tickets.id').count - tickets = Ticket.where(access_condition).where(query, *bind_params).joins(tables).group('tickets.id').limit(limit) + ticket_count = Ticket.where(access_condition).where(query, *bind_params).joins(tables).count + tickets = Ticket.where(access_condition).where(query, *bind_params).joins(tables).limit(limit) return [ticket_count, tickets] rescue ActiveRecord::StatementInvalid => e diff --git a/app/models/ticket/overviews.rb b/app/models/ticket/overviews.rb index 354511361..393490f19 100644 --- a/app/models/ticket/overviews.rb +++ b/app/models/ticket/overviews.rb @@ -113,11 +113,10 @@ returns end end - ticket_result = Ticket.select('tickets.id, tickets.updated_at') + ticket_result = Ticket.select('id, updated_at') .where(access_condition) .where(query_condition, *bind_condition) .joins(tables) - .group('tickets.id') .order(order_by) .limit(1000) .pluck(:id, :updated_at) @@ -130,7 +129,7 @@ returns } tickets.push ticket_item end - count = Ticket.where(access_condition).where(query_condition, *bind_condition).joins(tables).group('tickets.id').count() + count = Ticket.where(access_condition).where(query_condition, *bind_condition).joins(tables).count() item = { overview: { name: overview.name,