From b81378219d000debf581c41ed7a5a6cdb7cbd932 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Thu, 20 Apr 2017 17:12:39 +0200 Subject: [PATCH] Improved dashboard widget for waiting to also calculate tickets which are not open (#759). --- lib/stats/ticket_waiting_time.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/stats/ticket_waiting_time.rb b/lib/stats/ticket_waiting_time.rb index 106815c2c..efcc10427 100644 --- a/lib/stats/ticket_waiting_time.rb +++ b/lib/stats/ticket_waiting_time.rb @@ -4,16 +4,14 @@ class Stats::TicketWaitingTime def self.generate(user) - open_state_ids = Ticket::State.by_category(:open).pluck(:id) - # get users groups group_ids = user.groups.map(&:id) own_waiting = Ticket.where( - 'owner_id = ? AND group_id IN (?) AND state_id IN (?) AND updated_at > ?', user.id, group_ids, open_state_ids, Time.zone.today + 'owner_id = ? AND group_id IN (?) AND updated_at > ?', user.id, group_ids, Time.zone.today ) all_waiting = Ticket.where( - 'group_id IN (?) AND state_id IN (?) AND updated_at > ?', group_ids, open_state_ids, Time.zone.today + 'group_id IN (?) AND updated_at > ?', group_ids, Time.zone.today ) handling_time = calculate_average(own_waiting, Time.zone.today)