Revert "Fixed issue #1769 - Ticket shown multiple times in overview."

This reverts commit 371a0494b7.
This commit is contained in:
Martin Edenhofer 2018-02-08 06:37:15 +01:00
parent d0e25f2e5b
commit 4b99614503
2 changed files with 6 additions and 7 deletions

View file

@ -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

View file

@ -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,