Moved check if escalation is ignored to Ticket::State.ignore_escalation?, thanks to Roy!
This commit is contained in:
parent
c139ea0e1f
commit
39a0fde251
2 changed files with 27 additions and 5 deletions
|
@ -521,7 +521,7 @@ class Ticket < ApplicationModel
|
|||
|
||||
def self.escalation_calculation_rebuild
|
||||
ticket_state_list_open = Ticket::State.by_category( 'open' )
|
||||
|
||||
|
||||
tickets = Ticket.where( :ticket_state_id => ticket_state_list_open )
|
||||
tickets.each {|ticket|
|
||||
ticket.escalation_calculation
|
||||
|
@ -577,10 +577,8 @@ class Ticket < ApplicationModel
|
|||
def escalation_calculation
|
||||
|
||||
# set escalation off if ticket is already closed
|
||||
ticket_state = Ticket::State.lookup( :id => self.ticket_state_id )
|
||||
ticket_state_type = Ticket::StateType.lookup( :id => ticket_state.state_type_id )
|
||||
ignore_escalation = ['removed', 'closed', 'merged', 'pending action']
|
||||
if ignore_escalation.include?( ticket_state_type.name )
|
||||
ticket_state = Ticket::State.lookup( :id => self.ticket_state_id )
|
||||
if ticket_state.ignore_escalation?
|
||||
self.escalation_time = nil
|
||||
# self.first_response_escal_date = nil
|
||||
# self.close_time_escal_date = nil
|
||||
|
|
|
@ -10,6 +10,10 @@ list tickets by customer
|
|||
|
||||
states = Ticket::State.by_category('open') # open|closed
|
||||
|
||||
returns:
|
||||
|
||||
state objects
|
||||
|
||||
=end
|
||||
|
||||
def self.by_category(category)
|
||||
|
@ -24,4 +28,24 @@ list tickets by customer
|
|||
end
|
||||
raise "Unknown category '#{category}'"
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
check if state is ignored for escalation
|
||||
|
||||
ticket_state = Ticket::State.lookup( :name => 'state name' )
|
||||
|
||||
result = ticket_state.ignore_escalation?
|
||||
|
||||
returns:
|
||||
|
||||
true/false
|
||||
|
||||
=end
|
||||
|
||||
def ignore_escalation?
|
||||
ignore_escalation = ['removed', 'closed', 'merged']
|
||||
return true if ignore_escalation.include?( self.name )
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue