Improved sla calculation.

This commit is contained in:
Martin Edenhofer 2013-03-12 10:45:25 +01:00
parent 852339be1e
commit daa15738f9
2 changed files with 11 additions and 1 deletions

View file

@ -7,7 +7,7 @@ class Observer::Ticket::EscalationCalculation < ActiveRecord::Observer
def after_update(record)
# return if we run import mode
return if Setting.get('import_mode')
return if Setting.get('import_mode') && !Setting.get('import_igonre_sla')
# prevent loops
return if record[:escalation_calc]

View file

@ -501,6 +501,11 @@ class Ticket < ApplicationModel
self.first_response_in_min = diff.round
end
# set time over sla
if sla_selected.first_response_time && self.first_response_in_min
self.first_response_diff_in_min = sla_selected.first_response_time - self.first_response_in_min
end
# # update time
# if sla_selected.close_time
# created_at = Time.parse(self.created_at.to_s)
@ -525,6 +530,11 @@ class Ticket < ApplicationModel
self.close_time_in_min = diff.round
end
# set time over sla
if sla_selected.close_time && self.close_time_in_min
self.close_time_diff_in_min = sla_selected.close_time - self.close_time_in_min
end
self.save
end