From 714b88aa93ec08acf8c170e577e7f971688da68a Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Thu, 6 Jul 2017 11:05:28 +0200 Subject: [PATCH] Fixed issue #1194 - Add date/time information to time accounting (xls export). --- .../views/time_accounting/by_ticket.jst.eco | 4 + .../time_accountings_controller.rb | 92 +++++++++++++++++++ 2 files changed, 96 insertions(+) diff --git a/app/assets/javascripts/app/views/time_accounting/by_ticket.jst.eco b/app/assets/javascripts/app/views/time_accounting/by_ticket.jst.eco index 143de9e84..0f395dbf9 100644 --- a/app/assets/javascripts/app/views/time_accounting/by_ticket.jst.eco +++ b/app/assets/javascripts/app/views/time_accounting/by_ticket.jst.eco @@ -13,6 +13,8 @@ <%- @T('Agent') %> <%- @T('Time Units') %> <%- @T('Time Units Total') %> + <%- @T('Created at') %> + <%- @T('Closed at') %> <% for row in @rows: %> @@ -24,6 +26,8 @@ <%= row.agent %> <%= row.time_unit %> <%= row.ticket.time_unit %> + <%- @humanTime(row.ticket.created_at) %> + <%- @humanTime(row.ticket.close_at) %> <% end %> diff --git a/app/controllers/time_accountings_controller.rb b/app/controllers/time_accountings_controller.rb index f2acb1a09..69268dc2d 100644 --- a/app/controllers/time_accountings_controller.rb +++ b/app/controllers/time_accountings_controller.rb @@ -93,9 +93,84 @@ class TimeAccountingsController < ApplicationController name: 'Time Units Total', width: 10, }, + { + name: 'Created at', + width: 10, + }, + { + name: 'Closed at', + width: 10, + }, + { + name: 'Close Escalation At', + width: 10, + }, + { + name: 'Close In Min', + width: 10, + }, + { + name: 'Close Diff In Min', + width: 10, + }, + { + name: 'First Response At', + width: 10, + }, + { + name: 'First Response Escalation At', + width: 10, + }, + { + name: 'First Response In Min', + width: 10, + }, + { + name: 'First Response Diff In Min', + width: 10, + }, + { + name: 'Update Escalation At', + width: 10, + }, + { + name: 'Update In Min', + width: 10, + }, + { + name: 'Update Diff In Min', + width: 10, + }, + { + name: 'Last Contact At', + width: 10, + }, + { + name: 'Last Contact Agent At', + width: 10, + }, + { + name: 'Last Contact Customer At', + width: 10, + }, + { + name: 'Article Count', + width: 10, + }, + { + name: 'Escalation At', + width: 10, + }, ] result = [] results.each { |row| + row[:ticket].keys.each{|field| + next if row[:ticket][field].blank? + next if !row[:ticket][field].kind_of?(ActiveSupport::TimeWithZone) + + row[:ticket][field] = row[:ticket][field].iso8601 + } + result_row = [ row[:ticket]['number'], row[:ticket]['title'], @@ -104,6 +179,23 @@ class TimeAccountingsController < ApplicationController row[:agent], row[:time_unit], row[:ticket]['time_unit'], + row[:ticket]['created_at'], + row[:ticket]['close_at'], + row[:ticket]['close_escalation_at'], + row[:ticket]['close_in_min'], + row[:ticket]['close_diff_in_min'], + row[:ticket]['first_response_at'], + row[:ticket]['first_response_escalation_at'], + row[:ticket]['first_response_in_min'], + row[:ticket]['first_response_diff_in_min'], + row[:ticket]['update_escalation_at'], + row[:ticket]['update_in_min'], + row[:ticket]['update_diff_in_min'], + row[:ticket]['last_contact_at'], + row[:ticket]['last_contact_agent_at'], + row[:ticket]['last_contact_customer_at'], + row[:ticket]['article_count'], + row[:ticket]['escalation_at'], ] result.push result_row }