fest zum test

This commit is contained in:
Johannes Nickel 2013-06-13 15:19:50 +02:00
parent dfcfc7ab28
commit 02c2713856
2 changed files with 25 additions and 18 deletions

View file

@ -618,6 +618,9 @@ class Ticket < ApplicationModel
end end
if self.first_response# && !self.first_response_in_min if self.first_response# && !self.first_response_in_min
self.first_response_in_min = TimeCalculation.business_time_diff( self.created_at, self.first_response, sla_selected.data, sla_selected.timezone ) self.first_response_in_min = TimeCalculation.business_time_diff( self.created_at, self.first_response, sla_selected.data, sla_selected.timezone )
self.first_response_in_min = escalation_suspend( self.first_response, 'real', sla_selected )
#self.first_response_in_min = TimeCalculation.business_time_diff( self.first_response_in_min, extended_escalation.to_i, sla_selected.data, sla_selected.timezone )
end end
# set sla time # set sla time
if sla_selected.first_response_time && self.first_response_in_min if sla_selected.first_response_time && self.first_response_in_min
@ -655,9 +658,13 @@ class Ticket < ApplicationModel
end end
if self.close_time# && !self.close_time_in_min if self.close_time# && !self.close_time_in_min
self.close_time_in_min = TimeCalculation.business_time_diff( self.created_at, self.close_time, sla_selected.data, sla_selected.timezone ) self.close_time_in_min = TimeCalculation.business_time_diff( self.created_at, self.close_time, sla_selected.data, sla_selected.timezone )
puts '#### 1 ' + self.close_time_in_min.to_s
self.close_time_in_min == escalation_suspend( self.close_time, 'real', sla_selected )
puts '#### 2 ' + self.close_time_in_min.to_s
end end
# set sla time # set sla time
if sla_selected.close_time && self.close_time_in_min if sla_selected.close_time && self.close_time_in_min
puts '#### 3 ' + sla_selected.close_time.to_s + ' - ' + self.close_time_in_min.to_s
self.close_time_diff_in_min = 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 end
self.callback_loop = true self.callback_loop = true

View file

@ -618,19 +618,19 @@ class TicketTest < ActiveSupport::TestCase
) )
# set ticket from 11:00 to pending # set ticket from 11:00 to pending
History.history_create( #History.history_create(
:history_type => 'updated', # :history_type => 'updated',
:history_object => 'Ticket', # :history_object => 'Ticket',
:history_attribute => 'ticket_state', # :history_attribute => 'ticket_state',
:o_id => ticket.id, # :o_id => ticket.id,
:id_to => 3, # :id_to => 3,
:id_from => 2, # :id_from => 2,
:value_from => 'open', # :value_from => 'open',
:value_to => 'pending', # :value_to => 'pending',
:created_by_id => 1, # :created_by_id => 1,
:created_at => '2013-06-04 11:00:00', # :created_at => '2013-06-04 11:00:00',
:updated_at => '2013-06-04 11:00:00' # :updated_at => '2013-06-04 11:00:00'
) #)
# set first response in time # set first response in time
ticket.update_attributes( ticket.update_attributes(
@ -644,7 +644,7 @@ class TicketTest < ActiveSupport::TestCase
:o_id => ticket.id, :o_id => ticket.id,
:id_to => 3, :id_to => 3,
:id_from => 2, :id_from => 2,
:value_from => 'pending', :value_from => 'open',
:value_to => 'closed', :value_to => 'closed',
:created_by_id => 1, :created_by_id => 1,
:created_at => '2013-06-04 12:00:00', :created_at => '2013-06-04 12:00:00',
@ -675,12 +675,12 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id) ticket = Ticket.find(ticket.id)
assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 12:00:00 UTC', 'ticket.escalation_time verify 1' ) #check escal. time because first resp. is already done assert_equal( ticket.escalation_time.gmtime.to_s, '2013-06-04 12:00:00 UTC', 'ticket.escalation_time verify 1' ) #check escal. time because first resp. is already done
assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' ) assert_equal( ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 11:30:00 UTC', 'ticket.first_response_escal_date verify 1' )
#assert_equal( ticket.first_response_in_min, 75, 'ticket.first_response_in_min verify 3' ) assert_equal( ticket.first_response_in_min, 75, 'ticket.first_response_in_min verify 3' )
#assert_equal( ticket.first_response_diff_in_min, 45, 'ticket.first_response_diff_in_min verify 3' ) assert_equal( ticket.first_response_diff_in_min, 45, 'ticket.first_response_diff_in_min verify 3' )
#assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 12:30:00 UTC', 'ticket.update_time_escal_date verify 1' ) #assert_equal( ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 12:30:00 UTC', 'ticket.update_time_escal_date verify 1' )
#assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' ) #assert_equal( ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.close_time_escal_date verify 1' )
#assert_equal( ticket.close_time_in_min, 90, 'ticket.first_response_in_min verify 3' ) assert_equal( ticket.close_time_in_min, 150, 'ticket.close_time_in_min verify 3' )
#assert_equal( ticket.close_time_diff_in_min, 150, 'ticket.first_response_diff_in_min verify 3' ) assert_equal( ticket.close_time_diff_in_min, 150, 'ticket.close_time_diff_in_min# verify 3' )
delete = sla.destroy delete = sla.destroy
assert( delete, "sla destroy" ) assert( delete, "sla destroy" )