Merge branch 'private-ticket-renaming' into develop

This commit is contained in:
Martin Edenhofer 2016-09-15 01:34:28 +02:00
commit 739d5bc640
37 changed files with 528 additions and 483 deletions

View file

@ -3,7 +3,7 @@ class App.TicketZoomMeta extends App.ObserverController
observe:
number: true
created_at: true
escalation_time: true
escalation_at: true
render: (ticket) =>
@html App.view('ticket_zoom/meta')(

View file

@ -47,23 +47,23 @@ class App.Overview extends App.Model
name: 'Owner'
},
{
value: 'last_contact'
value: 'last_contact_at'
name: 'Last contact'
},
{
value: 'last_contact_agent'
value: 'last_contact_agent_at'
name: 'Last contact (Agent)'
},
{
value: 'last_contact_customer'
value: 'last_contact_customer_at'
name: 'Last contact (Customer)'
},
{
value: 'first_response'
value: 'first_response_at'
name: 'First Response'
},
{
value: 'close_time'
value: 'close_at'
name: 'Close time'
},
{
@ -90,21 +90,21 @@ class App.Overview extends App.Model
null: false
translate: true
options:
number: 'Number'
title: 'Title'
customer: 'Customer'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
last_contact: 'Last contact'
last_contact_agent: 'Last contact (Agent)'
last_contact_customer: 'Last contact (Customer)'
first_response: 'First Response'
close_time: 'Close time'
article_count: 'Article Count'
updated_at: 'Updated at'
created_at: 'Created at'
number: 'Number'
title: 'Title'
customer: 'Customer'
state: 'State'
priority: 'Priority'
group: 'Group'
owner: 'Owner'
last_contact_at: 'Last contact'
last_contact_agent_at: 'Last contact (Agent)'
last_contact_customer_at: 'Last contact (Customer)'
first_response_at: 'First Response'
close_at: 'Close time'
article_count: 'Article Count'
updated_at: 'Updated at'
created_at: 'Created at'
class: 'span4'
},
{

View file

@ -3,46 +3,46 @@ class App.Ticket extends App.Model
@extend Spine.Model.Ajax
@url: @apiPath + '/tickets'
@configure_attributes = [
{ name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, readonly: 1, width: '68px' },
{ name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false },
{ name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, autocapitalize: false, relation: 'User' },
{ name: 'organization_id', display: 'Organization', tag: 'select', relation: 'Organization', readonly: 1 },
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, relation: 'Group', width: '10%', edit: true },
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, relation: 'User', width: '12%', edit: true },
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', width: '12%', edit: true, customer: true },
{ name: 'pending_time', display: 'Pending Time', tag: 'datetime', null: true, width: '130px' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', width: '12%', edit: true, customer: true },
{ name: 'article_count', display: 'Article#', readonly: 1, width: '12%' },
{ name: 'escalation_time', display: 'Escalation', tag: 'datetime', null: true, readonly: 1, width: '110px', class: 'escalation' },
{ name: 'last_contact', display: 'Last contact', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'last_contact_agent', display: 'Last contact (Agent)', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'last_contact_customer', display: 'Last contact (Customer)', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'first_response', display: 'First response', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'close_time', display: 'Close time', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 },
{ name: 'created_at', display: 'Created at', tag: 'datetime', width: '110px', align: 'right', readonly: 1 },
{ name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 },
{ name: 'updated_at', display: 'Updated at', tag: 'datetime', width: '110px', align: 'right', readonly: 1 },
{ name: 'number', display: '#', tag: 'input', type: 'text', limit: 100, null: true, readonly: 1, width: '68px' },
{ name: 'title', display: 'Title', tag: 'input', type: 'text', limit: 100, null: false },
{ name: 'customer_id', display: 'Customer', tag: 'input', type: 'text', limit: 100, null: false, autocapitalize: false, relation: 'User' },
{ name: 'organization_id', display: 'Organization', tag: 'select', relation: 'Organization', readonly: 1 },
{ name: 'group_id', display: 'Group', tag: 'select', multiple: false, limit: 100, null: false, relation: 'Group', width: '10%', edit: true },
{ name: 'owner_id', display: 'Owner', tag: 'select', multiple: false, limit: 100, null: true, relation: 'User', width: '12%', edit: true },
{ name: 'state_id', display: 'State', tag: 'select', multiple: false, null: false, relation: 'TicketState', default: 'new', width: '12%', edit: true, customer: true },
{ name: 'pending_time', display: 'Pending Time', tag: 'datetime', null: true, width: '130px' },
{ name: 'priority_id', display: 'Priority', tag: 'select', multiple: false, null: false, relation: 'TicketPriority', default: '2 normal', width: '12%', edit: true, customer: true },
{ name: 'article_count', display: 'Article#', readonly: 1, width: '12%' },
{ name: 'escalation_at', display: 'Escalation', tag: 'datetime', null: true, readonly: 1, width: '110px', class: 'escalation' },
{ name: 'last_contact_at', display: 'Last contact', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'last_contact_agent_at', display: 'Last contact (Agent)', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'last_contact_customer_at', display: 'Last contact (Customer)', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'first_response_at', display: 'First response', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'close_at', display: 'Close time', tag: 'datetime', null: true, readonly: 1, width: '110px' },
{ name: 'created_by_id', display: 'Created by', relation: 'User', readonly: 1 },
{ name: 'created_at', display: 'Created at', tag: 'datetime', width: '110px', align: 'right', readonly: 1 },
{ name: 'updated_by_id', display: 'Updated by', relation: 'User', readonly: 1 },
{ name: 'updated_at', display: 'Updated at', tag: 'datetime', width: '110px', align: 'right', readonly: 1 },
]
uiUrl: ->
'#ticket/zoom/' + @id
getState: ->
type = App.TicketState.find( @state_id )
stateType = App.TicketStateType.find( type.state_type_id )
type = App.TicketState.find(@state_id)
stateType = App.TicketStateType.find(type.state_type_id)
state = 'closed'
if stateType.name is 'new' || stateType.name is 'open'
state = 'open'
# if ticket is escalated, overwrite state
if @escalation_time && new Date( Date.parse( @escalation_time ) ) < new Date
if @escalation_at && new Date( Date.parse(@escalation_at) ) < new Date
state = 'escalating'
else if stateType.name is 'pending reminder'
state = 'pending'
# if ticket pending_time is reached, overwrite state
if @pending_time && new Date( Date.parse( @pending_time ) ) < new Date
if @pending_time && new Date( Date.parse(@pending_time) ) < new Date
state = 'open'
else if stateType.name is 'pending action'
state = 'pending'
@ -55,11 +55,11 @@ class App.Ticket extends App.Model
@getState()
iconTitle: ->
type = App.TicketState.find( @state_id )
stateType = App.TicketStateType.find( type.state_type_id )
if stateType.name is 'pending reminder' && @pending_time && new Date( Date.parse( @pending_time ) ) < new Date
type = App.TicketState.find(@state_id)
stateType = App.TicketStateType.find(type.state_type_id)
if stateType.name is 'pending reminder' && @pending_time && new Date( Date.parse(@pending_time) ) < new Date
return "#{App.i18n.translateInline(type.displayName())} - #{App.i18n.translateInline('reached')}"
if @escalation_time && new Date( Date.parse( @escalation_time ) ) < new Date
if @escalation_at && new Date( Date.parse(@escalation_at) ) < new Date
return "#{App.i18n.translateInline(type.displayName())} - #{App.i18n.translateInline('escalated')}"
App.i18n.translateInline(type.displayName())

View file

@ -1,3 +1,3 @@
<small class="task-subline">
<%- @C('ticket_hook') %> <span class="ticket-number js-objectNumber" data-number="<%- @C('ticket_hook') %><%- @ticket.number %>"><%- @ticket.number %></span> - <%- @T('created') %> <%- @humanTime(@ticket.created_at) %> <% if !@isCustomer && @ticket.escalation_time: %> - <%- @T('escalation') %> <%- @humanTime(@ticket.escalation_time, true) %><% end %>
<%- @C('ticket_hook') %> <span class="ticket-number js-objectNumber" data-number="<%- @C('ticket_hook') %><%- @ticket.number %>"><%- @ticket.number %></span> - <%- @T('created') %> <%- @humanTime(@ticket.created_at) %> <% if !@isCustomer && @ticket.escalation_at: %> - <%- @T('escalation') %> <%- @humanTime(@ticket.escalation_at, true) %><% end %>
</small>

View file

@ -37,7 +37,7 @@ class ReportsController < ApplicationController
}
#created = aggs(start, stop, range, 'created_at', profile.condition)
#closed = aggs(start, stop, range, 'close_time', profile.condition)
#closed = aggs(start, stop, range, 'close_at', profile.condition)
#first_solution =
#reopend = backend(start, stop, range, Report::TicketReopened, profile.condition)
@ -208,7 +208,7 @@ class ReportsController < ApplicationController
worksheet.write(row, 4, ticket.customer.fullname)
worksheet.write(row, 5, ticket.created_at)
worksheet.write(row, 6, ticket.updated_at)
worksheet.write(row, 7, ticket.close_time)
worksheet.write(row, 7, ticket.close_at)
}
workbook.close

View file

@ -543,7 +543,7 @@ class TicketsController < ApplicationController
.count
# closed
closed = Ticket.where('close_time > ? AND close_time < ?', date_start, date_end )
closed = Ticket.where('close_at > ? AND close_at < ?', date_start, date_end )
.where(access_condition)
.where(condition)
.count
@ -614,7 +614,7 @@ class TicketsController < ApplicationController
created = Ticket.where('created_at > ? AND created_at < ?', date_start, date_end ).where(condition).count
# closed
closed = Ticket.where('close_time > ? AND close_time < ?', date_start, date_end ).where(condition).count
closed = Ticket.where('close_at > ? AND close_at < ?', date_start, date_end ).where(condition).count
data = {
month: date_to_check.month,

View file

@ -10,7 +10,7 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
changed = true
end
if first_response_update(record)
if first_response_at_update(record)
changed = true
end
@ -18,7 +18,7 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
changed = true
end
if last_contact_update(record)
if last_contact_update_at(record)
changed = true
end
@ -41,7 +41,7 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
end
# set frist response
def first_response_update(record)
def first_response_at_update(record)
# return if we run import mode
return false if Setting.get('import_mode')
@ -57,11 +57,11 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
type = Ticket::Article::Type.lookup(id: record.type_id)
return false if !type.communication
# check if first_response is already set
return false if record.ticket.first_response
# check if first_response_at is already set
return false if record.ticket.first_response_at
# set first_response
record.ticket.first_response = record.created_at
# set first_response_at
record.ticket.first_response_at = record.created_at
true
end
@ -79,7 +79,7 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
end
# set last contact
def last_contact_update(record)
def last_contact_update_at(record)
# if article in internal
return false if record.internal
@ -97,20 +97,20 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
if sender.name == 'Customer'
# if customer is sending agains, ignore update of last contact (usecase of update escalation)
return false if ticket.last_contact_customer &&
ticket.last_contact &&
ticket.last_contact_customer == ticket.last_contact
return false if ticket.last_contact_customer_at &&
ticket.last_contact_at &&
ticket.last_contact_customer_at == ticket.last_contact_at
# check if last communication is done by agent, else do not set last_contact_customer
if ticket.last_contact_customer.nil? ||
ticket.last_contact_agent.nil? ||
ticket.last_contact_agent.to_i > ticket.last_contact_customer.to_i
# check if last communication is done by agent, else do not set last_contact_customer_at
if ticket.last_contact_customer_at.nil? ||
ticket.last_contact_agent_at.nil? ||
ticket.last_contact_agent_at.to_i > ticket.last_contact_customer_at.to_i
# set last_contact customer
record.ticket.last_contact_customer = record.created_at
# set last_contact_at customer
record.ticket.last_contact_customer_at = record.created_at
# set last_contact
record.ticket.last_contact = record.created_at
record.ticket.last_contact_at = record.created_at
end
return true
@ -119,11 +119,11 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
# if sender is not agent
return false if sender.name != 'Agent'
# set last_contact_agent
record.ticket.last_contact_agent = record.created_at
# set last_contact_agent_at
record.ticket.last_contact_agent_at = record.created_at
# set last_contact
record.ticket.last_contact = record.created_at
record.ticket.last_contact_at = record.created_at
true
end

View file

@ -18,8 +18,8 @@ class Observer::Ticket::CloseTime < ActiveRecord::Observer
# return if we run import mode
return if Setting.get('import_mode')
# check if close_time is already set
return true if record.close_time
# check if close_at is already set
return true if record.close_at
# check if ticket is closed now
return if !record.state_id
@ -27,7 +27,7 @@ class Observer::Ticket::CloseTime < ActiveRecord::Observer
state_type = Ticket::StateType.lookup(id: state.state_type_id)
return true if state_type.name != 'closed'
# set close_time
record.close_time = Time.zone.now
# set close_at
record.close_at = Time.zone.now
end
end

View file

@ -196,11 +196,11 @@ class Observer::Transaction < ActiveRecord::Observer
real_changes = {}
record.changes.each { |key, value|
next if key == 'updated_at'
next if key == 'first_response'
next if key == 'close_time'
next if key == 'last_contact_agent'
next if key == 'last_contact_customer'
next if key == 'last_contact'
next if key == 'first_response_at'
next if key == 'close_at'
next if key == 'last_contact_agent_at'
next if key == 'last_contact_customer_at'
next if key == 'last_contact_at'
next if key == 'article_count'
next if key == 'create_article_type_id'
next if key == 'create_article_sender_id'

View file

@ -25,7 +25,7 @@ class Report
selected: true,
dataDownload: true,
adapter: Report::TicketGenericTime,
params: { field: 'close_time' },
params: { field: 'close_at' },
},
{
name: 'backlog',

View file

@ -35,23 +35,20 @@ class Ticket < ApplicationModel
create_article_type_id: true,
create_article_sender_id: true,
article_count: true,
first_response: true,
first_response_escal_date: true,
first_response_sla_time: true,
first_response_at: true,
first_response_escalation_at: true,
first_response_in_min: true,
first_response_diff_in_min: true,
close_time: true,
close_time_escal_date: true,
close_time_sla_time: true,
close_time_in_min: true,
close_time_diff_in_min: true,
update_time_escal_date: true,
update_time_sla_time: true,
update_time_in_min: true,
update_time_diff_in_min: true,
last_contact: true,
last_contact_agent: true,
last_contact_customer: true,
close_at: true,
close_escalation_at: true,
close_in_min: true,
close_diff_in_min: true,
update_escalation_at: true,
update_in_min: true,
update_diff_in_min: true,
last_contact_at: true,
last_contact_agent_at: true,
last_contact_customer_at: true,
}
)
@ -228,7 +225,7 @@ returns
# get max warning diff
tickets = where('escalation_time <= ?', Time.zone.now + 15.minutes)
tickets = where('escalation_at <= ?', Time.zone.now + 15.minutes)
tickets.each { |ticket|
@ -242,7 +239,7 @@ returns
end
# send escalation
if ticket.escalation_time < Time.zone.now
if ticket.escalation_at < Time.zone.now
Transaction::BackgroundJob.run(
object: 'Ticket',
type: 'escalation',
@ -447,7 +444,7 @@ condition example
pre_condition: 'specific',
value: 4711,
},
'ticket.escalation_time' => {
'ticket.escalation_at' => {
operator: 'is not', # not
value: nil,
}

View file

@ -58,8 +58,8 @@ returns
# early exit if nothing current state is not escalation relativ
if !force
return false if escalation_time.nil?
self.escalation_time = nil
return false if escalation_at.nil?
self.escalation_at = nil
return true
end
end
@ -76,22 +76,22 @@ returns
preferences[:escalation_calculation] = {}
# nothing to change
return false if !escalation_time
self.escalation_time = nil
return false if !escalation_at
self.escalation_at = nil
return true
end
# get last_update
if !last_contact_customer && !last_contact_agent
last_update = created_at
elsif !last_contact_customer && last_contact_agent
last_update = last_contact_agent
elsif last_contact_customer && !last_contact_agent
last_update = last_contact_customer
elsif last_contact_agent > last_contact_customer
last_update = last_contact_agent
elsif last_contact_agent < last_contact_customer
last_update = last_contact_customer
# get last_update_at
if !last_contact_customer_at && !last_contact_agent_at
last_update_at = created_at
elsif !last_contact_customer_at && last_contact_agent_at
last_update_at = last_contact_agent_at
elsif last_contact_customer_at && !last_contact_agent_at
last_update_at = last_contact_customer_at
elsif last_contact_agent_at > last_contact_customer_at
last_update_at = last_contact_agent_at
elsif last_contact_agent_at < last_contact_customer_at
last_update_at = last_contact_customer_at
end
# check if calculation need be done
@ -107,23 +107,23 @@ returns
if sla_changed == true || calendar_changed == true
force = true
end
first_response_changed = true
if escalation_calculation['first_response'] == first_response
first_response_changed = false
first_response_at_changed = true
if escalation_calculation['first_response_at'] == first_response_at
first_response_at_changed = false
end
last_update_changed = true
if escalation_calculation['last_update'] == last_update
last_update_changed = false
last_update_at_changed = true
if escalation_calculation['last_update_at'] == last_update_at
last_update_at_changed = false
end
close_time_changed = true
if escalation_calculation['close_time'] == close_time
close_time_changed = false
close_at_changed = true
if escalation_calculation['close_at'] == close_at
close_at_changed = false
end
if !force && preferences[:escalation_calculation]
if first_response_changed == false &&
last_update_changed == false &&
close_time_changed == false &&
if first_response_at_changed == false &&
last_update_at_changed == false &&
close_at_changed == false &&
sla_changed == false &&
calendar_changed == false &&
escalation_calculation['escalation_disabled'] == escalation_disabled
@ -132,11 +132,11 @@ returns
end
# reset escalation attributes
self.escalation_time = nil
self.escalation_at = nil
if force == true
self.first_response_escal_date = nil
self.update_time_escal_date = nil
self.close_time_escal_date = nil
self.first_response_escalation_at = nil
self.update_escalation_at = nil
self.close_escalation_at = nil
end
biz = Biz::Schedule.new do |config|
@ -175,17 +175,17 @@ returns
history_data = nil
# calculate first response escalation
if force == true || first_response_changed == true
if force == true || first_response_at_changed == true
if !history_data
history_data = history_get
end
if sla.first_response_time
self.first_response_escal_date = destination_time(created_at, sla.first_response_time, biz, history_data)
self.first_response_escalation_at = destination_time(created_at, sla.first_response_time, biz, history_data)
end
# get response time in min
if first_response
self.first_response_in_min = pending_minutes(created_at, first_response, biz, history_data, 'business_minutes')
if first_response_at
self.first_response_in_min = pending_minutes(created_at, first_response_at, biz, history_data, 'business_minutes')
end
# set time to show if sla is raised or not
@ -195,65 +195,65 @@ returns
end
# calculate update time escalation
if force == true || last_update_changed == true
if force == true || last_update_at_changed == true
if !history_data
history_data = history_get
end
if sla.update_time && last_update
self.update_time_escal_date = destination_time(last_update, sla.update_time, biz, history_data)
if sla.update_time && last_update_at
self.update_escalation_at = destination_time(last_update_at, sla.update_time, biz, history_data)
end
# get update time in min
if last_update && last_update != created_at
self.update_time_in_min = pending_minutes(created_at, last_update, biz, history_data, 'business_minutes')
if last_update_at && last_update_at != created_at
self.update_in_min = pending_minutes(created_at, last_update_at, biz, history_data, 'business_minutes')
end
# set sla time
if sla.update_time && update_time_in_min
self.update_time_diff_in_min = sla.update_time - update_time_in_min
if sla.update_time && update_in_min
self.update_diff_in_min = sla.update_time - update_in_min
end
end
# calculate close time escalation
if force == true || close_time_changed == true
if force == true || close_at_changed == true
if !history_data
history_data = history_get
end
if sla.solution_time
self.close_time_escal_date = destination_time(created_at, sla.solution_time, biz, history_data)
self.close_escalation_at = destination_time(created_at, sla.solution_time, biz, history_data)
end
# get close time in min
if close_time
self.close_time_in_min = pending_minutes(created_at, close_time, biz, history_data, 'business_minutes')
if close_at
self.close_in_min = pending_minutes(created_at, close_at, biz, history_data, 'business_minutes')
end
# set time to show if sla is raised or not
if sla.solution_time && close_time_in_min
self.close_time_diff_in_min = sla.solution_time - close_time_in_min
if sla.solution_time && close_in_min
self.close_diff_in_min = sla.solution_time - close_in_min
end
end
# set closest escalation time
if escalation_disabled
self.escalation_time = nil
self.escalation_at = nil
else
if !first_response && first_response_escal_date
self.escalation_time = first_response_escal_date
if !first_response_at && first_response_escalation_at
self.escalation_at = first_response_escalation_at
end
if update_time_escal_date && ((!escalation_time && update_time_escal_date) || update_time_escal_date < escalation_time)
self.escalation_time = update_time_escal_date
if update_escalation_at && ((!escalation_at && update_escalation_at) || update_escalation_at < escalation_at)
self.escalation_at = update_escalation_at
end
if !close_time && close_time_escal_date && ((!escalation_time && close_time_escal_date) || close_time_escal_date < escalation_time)
self.escalation_time = close_time_escal_date
if !close_at && close_escalation_at && ((!escalation_at && close_escalation_at) || close_escalation_at < escalation_at)
self.escalation_at = close_escalation_at
end
end
# remember already counted time to do on next update only the diff
preferences[:escalation_calculation] = {
first_response: first_response,
last_update: last_update,
close_time: close_time,
first_response_at: first_response_at,
last_update_at: last_update_at,
close_at: close_at,
sla_id: sla.id,
sla_updated_at: sla.updated_at,
calendar_id: calendar.id,

View file

@ -66,10 +66,10 @@ class Transaction::Slack
sent_value = ticket.pending_time
elsif @item[:type] == 'escalation'
template = 'ticket_escalation'
sent_value = ticket.escalation_time
sent_value = ticket.escalation_at
elsif @item[:type] == 'escalation_warning'
template = 'ticket_escalation_warning'
sent_value = ticket.escalation_time
sent_value = ticket.escalation_at
else
raise "unknown type for notification #{@item[:type]}"
end
@ -95,7 +95,7 @@ class Transaction::Slack
# good, warning, danger
color = '#000000'
ticket_state_type = ticket.state.state_type.name
if ticket.escalation_time && ticket.escalation_time < Time.zone.now
if ticket.escalation_at && ticket.escalation_at < Time.zone.now
color = '#f35912'
elsif ticket_state_type == 'pending reminder'
if ticket.pending_time && ticket.pending_time < Time.zone.now

View file

@ -2,7 +2,7 @@ Ticket ist eskaliert (<%= d 'ticket.title' %>)
<div>Hallo <%= d 'recipient.firstname' %>,</div>
<br>
<div>Ticket (<%= d 'ticket.title' %>) von "<b><%= d 'ticket.customer.longname' %></b>" ist seit "<%= d 'ticket.escalation_time' %>" eskaliert!</div>
<div>Ticket (<%= d 'ticket.title' %>) von "<b><%= d 'ticket.customer.longname' %></b>" ist seit "<%= d 'ticket.escalation_at' %>" eskaliert!</div>
<br>
<% if @objects[:article] %>
<div>

View file

@ -2,7 +2,7 @@ Ticket is escalated (<%= d 'ticket.title' %>)
<div>Hi <%= d 'recipient.firstname' %>,</div>
<br>
<div>A ticket (<%= d 'ticket.title' %>) from "<b><%= d 'ticket.customer.longname' %></b>" is escalated since "<%= d 'ticket.escalation_time' %>"!</div>
<div>A ticket (<%= d 'ticket.title' %>) from "<b><%= d 'ticket.customer.longname' %></b>" is escalated since "<%= d 'ticket.escalation_at' %>"!</div>
<br>
<% if @objects[:article] %>
<div>

View file

@ -2,7 +2,7 @@ Ticket wird eskalieren (<%= d 'ticket.title' %>)
<div>Hallo <%= d 'recipient.firstname' %>,</div>
<br>
<div>Ticket (<%= d 'ticket.title' %>) von "<b><%= d 'ticket.customer.longname' %></b>" wird um "<%= d 'ticket.escalation_time' %>" eskalieren!</div>
<div>Ticket (<%= d 'ticket.title' %>) von "<b><%= d 'ticket.customer.longname' %></b>" wird um "<%= d 'ticket.escalation_at' %>" eskalieren!</div>
<br>
<% if @objects[:article] %>
<div>

View file

@ -2,7 +2,7 @@ Ticket will escalate (<%= d 'ticket.title' %>)
<div>Hi <%= d 'recipient.firstname' %>,</div>
<br>
<div>A ticket (<%= d 'ticket.title' %>) from "<b><%= d 'ticket.customer.longname' %></b>" will escalate at "<%= d 'ticket.escalation_time' %>"!</div>
<div>A ticket (<%= d 'ticket.title' %>) from "<b><%= d 'ticket.customer.longname' %></b>" will escalate at "<%= d 'ticket.escalation_at' %>"!</div>
<br>
<% if @objects[:article] %>
<div>

View file

@ -1,6 +1,6 @@
# <%= d 'ticket.title' %>
_<<%= c 'http_type' %>://<%= c 'fqdn' %>/#ticket/zoom/<%= d 'ticket.id' %>|Ticket#<%= d 'ticket.number' %>>: Escalated at <%= d 'ticket.escalation_time' %>_
A ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" is escalated since "<%= d 'ticket.escalation_time' %>"!
_<<%= c 'http_type' %>://<%= c 'fqdn' %>/#ticket/zoom/<%= d 'ticket.id' %>|Ticket#<%= d 'ticket.number' %>>: Escalated at <%= d 'ticket.escalation_at' %>_
A ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" is escalated since "<%= d 'ticket.escalation_at' %>"!
<% if @objects[:article] %>
<%= a_text 'article' %>

View file

@ -1,6 +1,6 @@
# <%= d 'ticket.title' %>
_<<%= c 'http_type' %>://<%= c 'fqdn' %>/#ticket/zoom/<%= d 'ticket.id' %>|Ticket#<%= d 'ticket.number' %>>: Will escalate at <%= d 'ticket.escalation_time' %>_
A ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" will escalate at "<%= d 'ticket.escalation_time' %>"!
_<<%= c 'http_type' %>://<%= c 'fqdn' %>/#ticket/zoom/<%= d 'ticket.id' %>|Ticket#<%= d 'ticket.number' %>>: Will escalate at <%= d 'ticket.escalation_at' %>_
A ticket (<%= d 'ticket.title' %>) from "<%= d 'ticket.customer.longname' %>" will escalate at "<%= d 'ticket.escalation_at' %>"!
<% if @objects[:article] %>
<%= a_text 'article' %>

View file

@ -41,27 +41,24 @@ class CreateTicket < ActiveRecord::Migration
t.column :owner_id, :integer, null: false
t.column :customer_id, :integer, null: false
t.column :note, :string, limit: 250, null: true
t.column :first_response, :timestamp, limit: 3, null: true
t.column :first_response_escal_date, :timestamp, limit: 3, null: true
t.column :first_response_sla_time, :timestamp, limit: 3, null: true
t.column :first_response_at, :timestamp, limit: 3, null: true
t.column :first_response_escalation_at, :timestamp, limit: 3, null: true
t.column :first_response_in_min, :integer, null: true
t.column :first_response_diff_in_min, :integer, null: true
t.column :close_time, :timestamp, limit: 3, null: true
t.column :close_time_escal_date, :timestamp, limit: 3, null: true
t.column :close_time_sla_time, :timestamp, limit: 3, null: true
t.column :close_time_in_min, :integer, null: true
t.column :close_time_diff_in_min, :integer, null: true
t.column :update_time_escal_date, :timestamp, limit: 3, null: true
t.column :update_time_sla_time, :timestamp, limit: 3, null: true
t.column :update_time_in_min, :integer, null: true
t.column :update_time_diff_in_min, :integer, null: true
t.column :last_contact, :timestamp, limit: 3, null: true
t.column :last_contact_agent, :timestamp, limit: 3, null: true
t.column :last_contact_customer, :timestamp, limit: 3, null: true
t.column :close_at, :timestamp, limit: 3, null: true
t.column :close_escalation_at, :timestamp, limit: 3, null: true
t.column :close_in_min, :integer, null: true
t.column :close_diff_in_min, :integer, null: true
t.column :update_escalation_at, :timestamp, limit: 3, null: true
t.column :update_in_min, :integer, null: true
t.column :update_diff_in_min, :integer, null: true
t.column :last_contact_at, :timestamp, limit: 3, null: true
t.column :last_contact_agent_at, :timestamp, limit: 3, null: true
t.column :last_contact_customer_at, :timestamp, limit: 3, null: true
t.column :create_article_type_id, :integer, null: true
t.column :create_article_sender_id, :integer, null: true
t.column :article_count, :integer, null: true
t.column :escalation_time, :timestamp, limit: 3, null: true
t.column :escalation_at, :timestamp, limit: 3, null: true
t.column :pending_time, :timestamp, limit: 3, null: true
t.column :type, :string, limit: 100, null: true
t.column :preferences, :text, limit: 500.kilobytes + 1, null: true
@ -77,20 +74,20 @@ class CreateTicket < ActiveRecord::Migration
add_index :tickets, [:number], unique: true
add_index :tickets, [:title]
add_index :tickets, [:created_at]
add_index :tickets, [:first_response]
add_index :tickets, [:first_response_escal_date]
add_index :tickets, [:first_response_at]
add_index :tickets, [:first_response_escalation_at]
add_index :tickets, [:first_response_in_min]
add_index :tickets, [:first_response_diff_in_min]
add_index :tickets, [:close_time]
add_index :tickets, [:close_time_escal_date]
add_index :tickets, [:close_time_in_min]
add_index :tickets, [:close_time_diff_in_min]
add_index :tickets, [:escalation_time]
add_index :tickets, [:update_time_in_min]
add_index :tickets, [:update_time_diff_in_min]
add_index :tickets, [:last_contact]
add_index :tickets, [:last_contact_agent]
add_index :tickets, [:last_contact_customer]
add_index :tickets, [:close_at]
add_index :tickets, [:close_escalation_at]
add_index :tickets, [:close_in_min]
add_index :tickets, [:close_diff_in_min]
add_index :tickets, [:escalation_at]
add_index :tickets, [:update_in_min]
add_index :tickets, [:update_diff_in_min]
add_index :tickets, [:last_contact_at]
add_index :tickets, [:last_contact_agent_at]
add_index :tickets, [:last_contact_customer_at]
add_index :tickets, [:create_article_type_id]
add_index :tickets, [:create_article_sender_id]
add_index :tickets, [:created_by_id]

View file

@ -0,0 +1,54 @@
class TicketRename < ActiveRecord::Migration
def up
# return if it's a new setup
return if !Setting.find_by(name: 'system_init_done')
rename_column :tickets, :first_response, :first_response_at
rename_column :tickets, :first_response_escal_date, :first_response_escalation_at
rename_column :tickets, :close_time, :close_at
rename_column :tickets, :close_time_escal_date, :close_escalation_at
rename_column :tickets, :close_time_in_min, :close_in_min
rename_column :tickets, :close_time_diff_in_min, :close_diff_in_min
rename_column :tickets, :update_time_escal_date, :update_escalation_at
rename_column :tickets, :update_time_in_min, :update_in_min
rename_column :tickets, :update_time_diff_in_min, :update_diff_in_min
rename_column :tickets, :escalation_time, :escalation_at
rename_column :tickets, :last_contact, :last_contact_at
rename_column :tickets, :last_contact_agent, :last_contact_agent_at
rename_column :tickets, :last_contact_customer, :last_contact_customer_at
remove_column :tickets, :first_response_sla_time
remove_column :tickets, :close_time_sla_time
remove_column :tickets, :update_time_sla_time
overview_role = Role.find_by(name: 'Agent')
Overview.create_or_update(
name: 'Escalated',
link: 'all_escalated',
prio: 1050,
role_id: overview_role.id,
condition: {
'ticket.escalation_at' => {
operator: 'within next (relative)',
value: '10',
range: 'minute',
},
},
order: {
by: 'escalation_at',
direction: 'ASC',
},
view: {
d: %w(title customer group owner escalation_at),
s: %w(title customer group owner escalation_at),
m: %w(number title customer group owner escalation_at),
view_mode_default: 's',
},
)
end
end

View file

@ -3219,20 +3219,20 @@ Overview.create_if_not_exists(
prio: 1050,
role_id: overview_role.id,
condition: {
'ticket.escalation_time' => {
'ticket.escalation_at' => {
operator: 'within next (relative)',
value: '10',
range: 'minute',
},
},
order: {
by: 'escalation_time',
by: 'escalation_at',
direction: 'ASC',
},
view: {
d: %w(title customer group owner escalation_time),
s: %w(title customer group owner escalation_time),
m: %w(number title customer group owner escalation_time),
d: %w(title customer group owner escalation_at),
s: %w(title customer group owner escalation_at),
m: %w(number title customer group owner escalation_at),
view_mode_default: 's',
},
)

View file

@ -172,7 +172,7 @@ class CalendarSubscriptions::Tickets
operator: 'is',
value: owner_ids,
},
'ticket.escalation_time' => {
'ticket.escalation_at' => {
operator: 'is not',
value: nil,
}
@ -189,17 +189,17 @@ class CalendarSubscriptions::Tickets
tickets.each do |ticket|
next if !ticket.escalation_time
next if !ticket.escalation_at
event_data = {}
escalation_time = ticket.escalation_time
if escalation_time < Time.zone.today
escalation_time = Time.zone.today
escalation_at = ticket.escalation_at
if escalation_at < Time.zone.today
escalation_at = Time.zone.today
end
event_data[:dtstart] = Icalendar::Values::DateTime.new(escalation_time, 'tzid' => @tzid)
event_data[:dtend] = Icalendar::Values::DateTime.new(escalation_time, 'tzid' => @tzid)
event_data[:dtstart] = Icalendar::Values::DateTime.new(escalation_at, 'tzid' => @tzid)
event_data[:dtend] = Icalendar::Values::DateTime.new(escalation_at, 'tzid' => @tzid)
event_data[:summary] = "#{translated_ticket_escalation}: '#{ticket.title}' #{customer}: #{ticket.customer.longname}"
event_data[:description] = "T##{ticket.number}"
if alarm?

View file

@ -561,14 +561,14 @@ module Import::OTRS
CustomerUserID: :customer,
Title: :title,
TicketID: :id,
FirstResponse: :first_response,
#FirstResponseTimeDestinationDate: :first_response_escal_date,
FirstResponse: :first_response_at,
#FirstResponseTimeDestinationDate: :first_response_escalation_at,
#FirstResponseInMin: :first_response_in_min,
#FirstResponseDiffInMin: :first_response_diff_in_min,
Closed: :close_time,
#SoltutionTimeDestinationDate: :close_time_escal_date,
#CloseTimeInMin: :close_time_in_min,
#CloseTimeDiffInMin: :close_time_diff_in_min,
Closed: :close_at,
#SoltutionTimeDestinationDate: :close_escalation_at,
#CloseTimeInMin: :close_in_min,
#CloseTimeDiffInMin: :close_diff_in_min,
},
Article: {
SenderType: :sender,

View file

@ -23,7 +23,7 @@ returns
local_params[:params][:field] = 'created_at'
created = Report::TicketGenericTime.aggs(local_params)
local_params[:params][:field] = 'close_time'
local_params[:params][:field] = 'close_at'
closed = Report::TicketGenericTime.aggs(local_params)
result = []

View file

@ -51,14 +51,14 @@ returns
stop = start + 1.minute
end
query, bind_params, tables = Ticket.selector2sql(params[:selector])
ticket_list = Ticket.select('tickets.id, tickets.close_time, tickets.created_at').where(
'tickets.close_time IS NOT NULL AND tickets.close_time >= ? AND tickets.close_time < ?',
ticket_list = Ticket.select('tickets.id, tickets.close_at, tickets.created_at').where(
'tickets.close_at IS NOT NULL AND tickets.close_at >= ? AND tickets.close_at < ?',
start,
stop,
).where(query, *bind_params).joins(tables)
count = 0
ticket_list.each { |ticket|
closed_at = ticket.close_time
closed_at = ticket.close_at
created_at = ticket.created_at
if (closed_at - (60 * 15) ) < created_at
count += 1
@ -90,8 +90,8 @@ returns
def self.items(params)
query, bind_params, tables = Ticket.selector2sql(params[:selector])
ticket_list = Ticket.select('tickets.id, tickets.close_time, tickets.created_at').where(
'tickets.close_time IS NOT NULL AND tickets.close_time >= ? AND tickets.close_time < ?',
ticket_list = Ticket.select('tickets.id, tickets.close_at, tickets.created_at').where(
'tickets.close_at IS NOT NULL AND tickets.close_at >= ? AND tickets.close_at < ?',
params[:range_start],
params[:range_end],
).where(query, *bind_params).joins(tables)
@ -99,7 +99,7 @@ returns
assets = {}
ticket_ids = []
ticket_list.each { |ticket|
closed_at = ticket.close_time
closed_at = ticket.close_at
created_at = ticket.created_at
if (closed_at - (60 * 15) ) < created_at
count += 1

View file

@ -11,12 +11,12 @@ class Stats::TicketEscalation
# owned tickets
own_escalated = Ticket.where(
'owner_id = ? AND group_id IN (?) AND state_id IN (?) AND escalation_time < ?', user.id, group_ids, open_state_ids, Time.zone.now
'owner_id = ? AND group_id IN (?) AND state_id IN (?) AND escalation_at < ?', user.id, group_ids, open_state_ids, Time.zone.now
).count
# all tickets
all_escalated = Ticket.where(
'group_id IN (?) AND state_id IN (?) AND escalation_time < ?', group_ids, open_state_ids, Time.zone.now
'group_id IN (?) AND state_id IN (?) AND escalation_at < ?', group_ids, open_state_ids, Time.zone.now
).count
average = '-'

View file

@ -15,7 +15,7 @@ class Stats::TicketInProcess
# get all tickets where I worked on today (owner & closed today)
closed_state_ids = Ticket::State.by_category('closed').map(&:id)
closed_ticket_ids = Ticket.select('id').where(
'owner_id = ? AND state_id IN (?) AND close_time > ?',
'owner_id = ? AND state_id IN (?) AND close_at > ?',
user.id, closed_state_ids, Time.zone.now - 1.day
).limit(100).map(&:id)

View file

@ -6,7 +6,7 @@ class Stats::TicketReopen
# get my closed tickets
total = Ticket.select('id').where(
'owner_id = ? AND close_time > ?',
'owner_id = ? AND close_at > ?',
user.id, Time.zone.now - 7.days
).count
@ -67,8 +67,8 @@ class Stats::TicketReopen
return if object != 'Ticket'
ticket = Ticket.lookup(id: o_id)
# check if close_time is already set / if not, ticket is not reopend
return if !ticket.close_time
# check if close_at is already set / if not, ticket is not reopend
return if !ticket.close_at
# only if state id has changed
return if !changes['state_id']

View file

@ -13,10 +13,10 @@ class Stats::TicketResponseTime
return if ticket.owner_id != 1 && ticket.owner_id != article_created_by_id
# return if customer send at least
return if ticket.last_contact_customer > ticket.last_contact_agent
return if ticket.last_contact_customer_at > ticket.last_contact_agent_at
# TODO: only business hours
response_time_taken = ticket.last_contact_agent - ticket.last_contact_customer
response_time_taken = ticket.last_contact_agent_at - ticket.last_contact_customer_at
(response_time_taken / 60).round
end

View file

@ -185,7 +185,7 @@ class OtrsImportTest < ActiveSupport::TestCase
assert_equal( 'partner', ticket.customer.login )
assert_equal( 'Partner der betreut', ticket.organization.name )
assert_equal( Time.zone.parse('2014-11-20 22:33:41 +0000').gmtime.to_s, ticket.created_at.to_s )
assert_equal( nil, ticket.close_time )
assert_equal( nil, ticket.close_at )
# check history
# - create entry
@ -200,7 +200,7 @@ class OtrsImportTest < ActiveSupport::TestCase
assert_equal( 'jn2', ticket.customer.login )
assert_equal( 'Znuny GmbH', ticket.organization.name )
assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.created_at.to_s )
assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_time.to_s )
assert_equal( Time.zone.parse('2014-11-20 23:24:20 +0000').gmtime.to_s, ticket.close_at.to_s )
# check history
# - create entry
@ -215,7 +215,7 @@ class OtrsImportTest < ActiveSupport::TestCase
assert_equal( 'betreuterkunde2', ticket.customer.login )
assert_equal( 'Noch ein betreuter Kunde', ticket.organization.name )
assert_equal( Time.zone.parse('2014-11-21 00:17:40 +0000').gmtime.to_s, ticket.created_at.to_s )
assert_equal( Time.zone.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_time.to_s )
assert_equal( Time.zone.parse('2014-11-21 00:21:08 +0000').gmtime.to_s, ticket.close_at.to_s )
# ticket dynamic fields
ticket = Ticket.find(591)

View file

@ -139,7 +139,7 @@ class ReportTest < ActiveSupport::TestCase
customer_id: 2,
state: Ticket::State.lookup(name: 'closed'),
priority: Ticket::Priority.lookup(name: '2 normal'),
close_time: '2015-10-28 11:30:00 UTC',
close_at: '2015-10-28 11:30:00 UTC',
created_at: '2015-10-28 10:30:00 UTC',
updated_at: '2015-10-28 10:30:00 UTC',
updated_by_id: 1,
@ -167,7 +167,7 @@ class ReportTest < ActiveSupport::TestCase
customer_id: 2,
state: Ticket::State.lookup(name: 'closed'),
priority: Ticket::Priority.lookup(name: '3 high'),
close_time: '2015-10-28 11:40:00 UTC',
close_at: '2015-10-28 11:40:00 UTC',
created_at: '2015-10-28 11:30:00 UTC',
updated_at: '2015-10-28 11:30:00 UTC',
updated_by_id: 1,
@ -199,7 +199,7 @@ class ReportTest < ActiveSupport::TestCase
customer_id: 2,
state: Ticket::State.lookup(name: 'closed'),
priority: Ticket::Priority.lookup(name: '2 normal'),
close_time: '2015-10-31 12:35:00 UTC',
close_at: '2015-10-31 12:35:00 UTC',
created_at: '2015-10-31 12:30:00 UTC',
updated_at: '2015-10-31 12:30:00 UTC',
updated_by_id: 1,
@ -227,7 +227,7 @@ class ReportTest < ActiveSupport::TestCase
customer_id: 2,
state: Ticket::State.lookup(name: 'closed'),
priority: Ticket::Priority.lookup(name: '2 normal'),
close_time: '2015-11-01 12:30:00 UTC',
close_at: '2015-11-01 12:30:00 UTC',
created_at: '2015-11-01 12:30:00 UTC',
updated_at: '2015-11-01 12:30:00 UTC',
updated_by_id: 1,

View file

@ -437,27 +437,24 @@ If you\'re reading this message in your email, click the ticket number link that
owner_id
customer_id
note
first_response
first_response_escal_date
first_response_sla_time
first_response_at
first_response_escalation_at
first_response_in_min
first_response_diff_in_min
close_time
close_time_escal_date
close_time_sla_time
close_time_in_min
close_time_diff_in_min
update_time_escal_date
update_time_sla_time
update_time_in_min
update_time_diff_in_min
last_contact
last_contact_agent
last_contact_customer
close_at
close_escalation_at
close_in_min
close_diff_in_min
update_escalation_at
update_in_min
update_diff_in_min
last_contact_at
last_contact_agent_at
last_contact_customer_at
create_article_type_id
create_article_sender_id
article_count
escalation_time
escalation_at
pending_time
type
preferences

View file

@ -134,7 +134,7 @@ class CalendarSubscriptionTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
ticket5.update_columns(escalation_time: '2016-02-07 17:39:00')
ticket5.update_columns(escalation_at: '2016-02-07 17:39:00')
ticket6 = Ticket.create!(
title: 'some title1 - escalation - group_default',
@ -147,7 +147,7 @@ class CalendarSubscriptionTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
ticket6.update_columns(escalation_time: '2016-02-07 16:37:00')
ticket6.update_columns(escalation_at: '2016-02-07 16:37:00')
ticket7 = Ticket.create!(
title: 'some title2 - new - group_calendar',
@ -206,7 +206,7 @@ class CalendarSubscriptionTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
ticket11.update_columns(escalation_time: '2016-02-08 18:37:00')
ticket11.update_columns(escalation_at: '2016-02-08 18:37:00')
ticket12 = Ticket.create!(
title: 'some title2 - escalation - group_default',
@ -219,8 +219,8 @@ class CalendarSubscriptionTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
ticket12.update_columns(escalation_time: '2016-02-08 18:38:00')
Cache.clear # set escalation_time manually, to clear cache to have correct content later
ticket12.update_columns(escalation_at: '2016-02-08 18:38:00')
Cache.clear # set escalation_at manually, to clear cache to have correct content later
# check agent 1
calendar_subscriptions = CalendarSubscriptions.new(agent1)

View file

@ -129,7 +129,7 @@ class TicketSelectorTest < ActiveSupport::TestCase
updated_by_id: 1,
created_by_id: 1,
)
ticket3.update_columns(escalation_time: '2015-02-06 10:00:00')
ticket3.update_columns(escalation_at: '2015-02-06 10:00:00')
assert(ticket3, 'ticket created')
assert_equal(ticket3.customer.id, customer2.id)
assert_equal(ticket3.organization_id, nil)
@ -287,7 +287,7 @@ class TicketSelectorTest < ActiveSupport::TestCase
assert_equal(ticket_count, 1)
condition = {
'ticket.escalation_time' => {
'ticket.escalation_at' => {
operator: 'is not',
value: nil,
}

View file

@ -23,7 +23,7 @@ class TicketSlaTest < ActiveSupport::TestCase
created_by_id: 1,
)
assert(ticket, 'ticket created')
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify')
calendar1 = Calendar.create_or_update(
name: 'EU 1',
@ -76,10 +76,10 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_escalation_at verify 1')
sla = Sla.create_or_update(
name: 'test sla 1',
@ -93,10 +93,10 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_escalation_at verify 1')
delete = sla.destroy
assert(delete, 'sla destroy 1')
@ -155,190 +155,190 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_time verify 2')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 2')
assert_equal(ticket.first_response, nil, 'ticket.first_response verify 2')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.escalation_at verify 2')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 2')
assert_equal(ticket.first_response_at, nil, 'ticket.first_response_at verify 2')
assert_equal(ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 2')
assert_equal(ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 2')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_time_escal_date verify 2')
assert_equal(ticket.update_time_in_min, nil, 'ticket.update_time_in_min verify 2')
assert_equal(ticket.update_time_diff_in_min, nil, 'ticket.update_time_diff_in_min verify 2')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_escalation_at verify 2')
assert_equal(ticket.update_in_min, nil, 'ticket.update_in_min verify 2')
assert_equal(ticket.update_diff_in_min, nil, 'ticket.update_diff_in_min verify 2')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 2')
assert_equal(ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 2')
assert_equal(ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 2')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 2')
assert_equal(ticket.close_in_min, nil, 'ticket.close_in_min verify 2')
assert_equal(ticket.close_diff_in_min, nil, 'ticket.close_diff_in_min verify 2')
# set first response in time
ticket.update_attributes(
first_response: '2013-03-21 10:00:00 UTC',
first_response_at: '2013-03-21 10:00:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 3')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 3')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 10:00:00 UTC', 'ticket.first_response verify 3')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_at verify 3')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 3')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 10:00:00 UTC', 'ticket.first_response_at verify 3')
assert_equal(ticket.first_response_in_min, 30, 'ticket.first_response_in_min verify 3')
assert_equal(ticket.first_response_diff_in_min, 30, 'ticket.first_response_diff_in_min verify 3')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_time_escal_date verify 3')
assert_equal(ticket.update_time_in_min, nil, 'ticket.update_time_in_min verify 3')
assert_equal(ticket.update_time_diff_in_min, nil, 'ticket.update_time_diff_in_min verify 3')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_escalation_at verify 3')
assert_equal(ticket.update_in_min, nil, 'ticket.update_in_min verify 3')
assert_equal(ticket.update_diff_in_min, nil, 'ticket.update_diff_in_min verify 3')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 3')
assert_equal(ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 3')
assert_equal(ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 3')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 3')
assert_equal(ticket.close_in_min, nil, 'ticket.close_in_min verify 3')
assert_equal(ticket.close_diff_in_min, nil, 'ticket.close_diff_in_min verify 3')
# set first reponse over time
ticket.update_attributes(
first_response: '2013-03-21 14:00:00 UTC',
first_response_at: '2013-03-21 14:00:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 4')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 4')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 4')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_at verify 4')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 4')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 4')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 4')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 4')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_time_escal_date verify 4')
assert_equal(ticket.update_time_in_min, nil, 'ticket.update_time_in_min verify 4')
assert_equal(ticket.update_time_diff_in_min, nil, 'ticket.update_time_diff_in_min verify 4')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.update_escalation_at verify 4')
assert_equal(ticket.update_in_min, nil, 'ticket.update_in_min verify 4')
assert_equal(ticket.update_diff_in_min, nil, 'ticket.update_diff_in_min verify 4')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 4')
assert_equal(ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 4')
assert_equal(ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 4')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 4')
assert_equal(ticket.close_in_min, nil, 'ticket.close_in_min verify 4')
assert_equal(ticket.close_diff_in_min, nil, 'ticket.close_diff_in_min verify 4')
# set update time in time
ticket.update_attributes(
last_contact_agent: '2013-03-21 11:00:00 UTC',
last_contact_agent_at: '2013-03-21 11:00:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 5')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 5')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 5')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 5')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 5')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 5')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 5')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 5')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 13:00:00 UTC', 'ticket.update_time_escal_date verify 5')
assert_equal(ticket.update_time_in_min, 90, 'ticket.update_time_in_min verify 5')
assert_equal(ticket.update_time_diff_in_min, 30, 'ticket.update_time_diff_in_min verify 5')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 13:00:00 UTC', 'ticket.update_escalation_at verify 5')
assert_equal(ticket.update_in_min, 90, 'ticket.update_in_min verify 5')
assert_equal(ticket.update_diff_in_min, 30, 'ticket.update_diff_in_min verify 5')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 5')
assert_equal(ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 5')
assert_equal(ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 5')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 5')
assert_equal(ticket.close_in_min, nil, 'ticket.close_in_min verify 5')
assert_equal(ticket.close_diff_in_min, nil, 'ticket.close_diff_in_min verify 5')
# set update time over time
ticket.update_attributes(
last_contact_agent: '2013-03-21 12:00:00 UTC',
last_contact_agent_at: '2013-03-21 12:00:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 6')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 6')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 6')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 6')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 6')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 6')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 6')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 6')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.update_time_escal_date verify 6')
assert_equal(ticket.update_time_in_min, 150, 'ticket.update_time_in_min verify 6')
assert_equal(ticket.update_time_diff_in_min, -30, 'ticket.update_time_diff_in_min verify 6')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.update_escalation_at verify 6')
assert_equal(ticket.update_in_min, 150, 'ticket.update_in_min verify 6')
assert_equal(ticket.update_diff_in_min, -30, 'ticket.update_diff_in_min verify 6')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 6')
assert_equal(ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 6')
assert_equal(ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 6')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 6')
assert_equal(ticket.close_in_min, nil, 'ticket.close_in_min verify 6')
assert_equal(ticket.close_diff_in_min, nil, 'ticket.close_diff_in_min verify 6')
# set update time over time
ticket.update_attributes(
last_contact_customer: '2013-03-21 12:05:00 UTC',
last_contact_customer_at: '2013-03-21 12:05:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 6')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 6')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 6')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 6')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 6')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 6')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 6')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 6')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:05:00 UTC', 'ticket.update_time_escal_date verify 6')
assert_equal(ticket.update_time_in_min, 155, 'ticket.update_time_in_min verify 6')
assert_equal(ticket.update_time_diff_in_min, -35, 'ticket.update_time_diff_in_min verify 6')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 14:05:00 UTC', 'ticket.update_escalation_at verify 6')
assert_equal(ticket.update_in_min, 155, 'ticket.update_in_min verify 6')
assert_equal(ticket.update_diff_in_min, -35, 'ticket.update_diff_in_min verify 6')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 6')
assert_equal(ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 6')
assert_equal(ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 6')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 6')
assert_equal(ticket.close_in_min, nil, 'ticket.close_in_min verify 6')
assert_equal(ticket.close_diff_in_min, nil, 'ticket.close_diff_in_min verify 6')
# set update time over time
ticket.update_attributes(
last_contact_agent: '2013-03-21 12:10:00 UTC',
last_contact_agent_at: '2013-03-21 12:10:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_time verify 6')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.escalation_at verify 6')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 6')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 6')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 6')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 6')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 6')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 6')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_time_escal_date verify 6')
assert_equal(ticket.update_time_in_min, 160, 'ticket.update_time_in_min verify 6')
assert_equal(ticket.update_time_diff_in_min, -40, 'ticket.update_time_diff_in_min verify 6')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_escalation_at verify 6')
assert_equal(ticket.update_in_min, 160, 'ticket.update_in_min verify 6')
assert_equal(ticket.update_diff_in_min, -40, 'ticket.update_diff_in_min verify 6')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 6')
assert_equal(ticket.close_time_in_min, nil, 'ticket.close_time_in_min verify 6')
assert_equal(ticket.close_time_diff_in_min, nil, 'ticket.close_time_diff_in_min verify 6')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 6')
assert_equal(ticket.close_in_min, nil, 'ticket.close_in_min verify 6')
assert_equal(ticket.close_diff_in_min, nil, 'ticket.close_diff_in_min verify 6')
# set close time in time
ticket.update_attributes(
close_time: '2013-03-21 11:30:00 UTC',
close_at: '2013-03-21 11:30:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.escalation_time verify 7')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.escalation_at verify 7')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 7')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 7')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 7')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 7')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 7')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 7')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_time_escal_date verify 7')
assert_equal(ticket.update_time_in_min, 160, 'ticket.update_time_in_min verify 7')
assert_equal(ticket.update_time_diff_in_min, -40, 'ticket.update_time_diff_in_min verify 7')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_escalation_at verify 7')
assert_equal(ticket.update_in_min, 160, 'ticket.update_in_min verify 7')
assert_equal(ticket.update_diff_in_min, -40, 'ticket.update_diff_in_min verify 7')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 7')
assert_equal(ticket.close_time_in_min, 120, 'ticket.close_time_in_min verify 7')
assert_equal(ticket.close_time_diff_in_min, 60, 'ticket.close_time_diff_in_min verify 7')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 7')
assert_equal(ticket.close_in_min, 120, 'ticket.close_in_min verify 7')
assert_equal(ticket.close_diff_in_min, 60, 'ticket.close_diff_in_min verify 7')
# set close time over time
ticket.update_attributes(
close_time: '2013-03-21 13:00:00 UTC',
close_at: '2013-03-21 13:00:00 UTC',
)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.escalation_time verify 8')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.escalation_at verify 8')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 8')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 8')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 8')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 8')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 8')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 8')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_time_escal_date verify 8')
assert_equal(ticket.update_time_in_min, 160, 'ticket.update_time_in_min verify 8')
assert_equal(ticket.update_time_diff_in_min, -40, 'ticket.update_time_diff_in_min verify 8')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_escalation_at verify 8')
assert_equal(ticket.update_in_min, 160, 'ticket.update_in_min verify 8')
assert_equal(ticket.update_diff_in_min, -40, 'ticket.update_diff_in_min verify 8')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 8')
assert_equal(ticket.close_time_in_min, 210, 'ticket.close_time_in_min verify 8')
assert_equal(ticket.close_time_diff_in_min, -30, 'ticket.close_time_diff_in_min verify 8')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 8')
assert_equal(ticket.close_in_min, 210, 'ticket.close_in_min verify 8')
assert_equal(ticket.close_diff_in_min, -30, 'ticket.close_diff_in_min verify 8')
# set close time over time
ticket.update_attributes(
state: Ticket::State.lookup(name: 'closed')
)
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify 9')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify 9')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escal_date verify 9')
assert_equal(ticket.first_response.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response verify 9')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 10:30:00 UTC', 'ticket.first_response_escalation_at verify 9')
assert_equal(ticket.first_response_at.gmtime.to_s, '2013-03-21 14:00:00 UTC', 'ticket.first_response_at verify 9')
assert_equal(ticket.first_response_in_min, 270, 'ticket.first_response_in_min verify 9')
assert_equal(ticket.first_response_diff_in_min, -210, 'ticket.first_response_diff_in_min verify 9')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_time_escal_date verify 9')
assert_equal(ticket.update_time_in_min, 160, 'ticket.update_time_in_min verify 9')
assert_equal(ticket.update_time_diff_in_min, -40, 'ticket.update_time_diff_in_min verify 9')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 14:10:00 UTC', 'ticket.update_escalation_at verify 9')
assert_equal(ticket.update_in_min, 160, 'ticket.update_in_min verify 9')
assert_equal(ticket.update_diff_in_min, -40, 'ticket.update_diff_in_min verify 9')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_time_escal_date verify 9')
assert_equal(ticket.close_time_in_min, 210, 'ticket.close_time_in_min verify 9')
assert_equal(ticket.close_time_diff_in_min, -30, 'ticket.close_time_diff_in_min verify 9')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.close_escalation_at verify 9')
assert_equal(ticket.close_in_min, 210, 'ticket.close_in_min verify 9')
assert_equal(ticket.close_diff_in_min, -30, 'ticket.close_diff_in_min verify 9')
delete = ticket.destroy
assert(delete, 'ticket destroy')
@ -378,11 +378,11 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 1, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_inbound.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound')
assert_equal(ticket.first_response, nil, 'ticket.first_response verify - inbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - inbound')
assert_equal(ticket.last_contact_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_at verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at, nil, 'ticket.last_contact_agent_at verify - inbound')
assert_equal(ticket.first_response_at, nil, 'ticket.first_response_at verify - inbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound')
# create outbound article
article_outbound = Ticket::Article.create!(
@ -403,13 +403,13 @@ class TicketSlaTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 2, 'ticket.article_count verify - outbound')
assert_equal(ticket.last_contact.to_s, article_outbound.created_at.to_s, 'ticket.last_contact verify - outbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - outbound')
assert_equal(ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - outbound')
assert_equal(ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound')
assert_equal(ticket.last_contact_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_at verify - outbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer_at verify - outbound')
assert_equal(ticket.last_contact_agent_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent_at verify - outbound')
assert_equal(ticket.first_response_at.to_s, article_outbound.created_at.to_s, 'ticket.first_response_at verify - outbound')
assert_equal(ticket.first_response_in_min, 0, 'ticket.first_response_in_min verify - outbound')
assert_equal(ticket.first_response_diff_in_min, 60, 'ticket.first_response_diff_in_min verify - outbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - outbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - outbound')
delete = ticket.destroy
assert(delete, 'ticket destroy')
@ -448,11 +448,11 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 1, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_inbound.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound')
assert_equal(ticket.first_response, nil, 'ticket.first_response verify - inbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - inbound')
assert_equal(ticket.last_contact_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_at verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at, nil, 'ticket.last_contact_agent_at verify - inbound')
assert_equal(ticket.first_response_at, nil, 'ticket.first_response_at verify - inbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound')
# create note article
article_note = Ticket::Article.create!(
@ -471,11 +471,11 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 2, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_inbound.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound')
assert_equal(ticket.first_response, nil, 'ticket.first_response verify - inbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - inbound')
assert_equal(ticket.last_contact_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_at verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at, nil, 'ticket.last_contact_agent_at verify - inbound')
assert_equal(ticket.first_response_at, nil, 'ticket.first_response_at verify - inbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound')
# create outbound article
article_outbound = Ticket::Article.create!(
@ -494,11 +494,11 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 3, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_outbound.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - inbound')
assert_equal(ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - inbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - inbound')
assert_equal(ticket.last_contact_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_at verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent_at verify - inbound')
assert_equal(ticket.first_response_at.to_s, article_outbound.created_at.to_s, 'ticket.first_response_at verify - inbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound')
delete = sla.destroy
assert(delete, 'sla destroy')
@ -527,7 +527,7 @@ class TicketSlaTest < ActiveSupport::TestCase
created_by_id: 1,
)
assert(ticket, 'ticket created')
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify')
# set sla's for timezone "Europe/Berlin" wintertime (+1), so UTC times are 7:00-16:00
calendar = Calendar.create_or_update(
@ -600,10 +600,10 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-03-21 11:30:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-03-21 12:30:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-03-21 13:30:00 UTC', 'ticket.close_escalation_at verify 1')
delete = sla.destroy
assert(delete, 'sla destroy')
@ -622,7 +622,7 @@ class TicketSlaTest < ActiveSupport::TestCase
created_by_id: 1,
)
assert(ticket, 'ticket created')
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify')
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 6:00-15:00
calendar = Calendar.create_or_update(
@ -689,10 +689,10 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-10-21 12:30:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-10-21 13:30:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-10-21 11:30:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-10-21 12:30:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-10-21 13:30:00 UTC', 'ticket.close_escalation_at verify 1')
delete = ticket.destroy
assert(delete, 'ticket destroy')
@ -712,7 +712,7 @@ class TicketSlaTest < ActiveSupport::TestCase
created_by_id: 1,
)
assert(ticket, 'ticket created')
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify')
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 6:00-15:00
sla = Sla.create_or_update(
@ -727,10 +727,10 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-10-21 09:00:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-10-21 10:00:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.escalation_at.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-10-21 08:00:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-10-21 09:00:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-10-21 10:00:00 UTC', 'ticket.close_escalation_at verify 1')
ticket = Ticket.create!(
title: 'some title holiday test',
@ -744,10 +744,10 @@ class TicketSlaTest < ActiveSupport::TestCase
created_by_id: 1,
)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2015-09-23 07:30:00 UTC', 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2015-09-23 07:30:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2015-09-23 08:30:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2015-09-23 09:30:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.escalation_at.gmtime.to_s, '2015-09-23 07:30:00 UTC', 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2015-09-23 07:30:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2015-09-23 08:30:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2015-09-23 09:30:00 UTC', 'ticket.close_escalation_at verify 1')
delete = sla.destroy
assert(delete, 'sla destroy')
@ -889,8 +889,8 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket1.escalation_calculation
ticket1 = Ticket.find(ticket1.id)
assert_equal(ticket1.escalation_time.gmtime.to_s, '2013-06-04 11:45:00 UTC', 'ticket1.escalation_time verify 1')
assert_equal(ticket1.first_response_escal_date.gmtime.to_s, '2013-06-04 11:45:00 UTC', 'ticket1.first_response_escal_date verify 1')
assert_equal(ticket1.escalation_at.gmtime.to_s, '2013-06-04 11:45:00 UTC', 'ticket1.escalation_at verify 1')
assert_equal(ticket1.first_response_escalation_at.gmtime.to_s, '2013-06-04 11:45:00 UTC', 'ticket1.first_response_escalation_at verify 1')
assert_equal(ticket1.first_response_in_min, nil, 'ticket1.first_response_in_min verify 3')
assert_equal(ticket1.first_response_diff_in_min, nil, 'ticket1.first_response_diff_in_min verify 3')
@ -938,8 +938,8 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket2.escalation_calculation(true)
ticket2 = Ticket.find(ticket2.id)
assert_equal(ticket2.escalation_time.gmtime.to_s, '2013-06-04 16:00:00 UTC', 'ticket2.escalation_time verify 1')
assert_equal(ticket2.first_response_escal_date.gmtime.to_s, '2013-06-04 16:00:00 UTC', 'ticket2.first_response_escal_date verify 1')
assert_equal(ticket2.escalation_at.gmtime.to_s, '2013-06-04 16:00:00 UTC', 'ticket2.escalation_at verify 1')
assert_equal(ticket2.first_response_escalation_at.gmtime.to_s, '2013-06-04 16:00:00 UTC', 'ticket2.first_response_escalation_at verify 1')
assert_equal(ticket2.first_response_in_min, nil, 'ticket2.first_response_in_min verify 3')
assert_equal(ticket2.first_response_diff_in_min, nil, 'ticket2.first_response_diff_in_min verify 3')
@ -998,12 +998,12 @@ class TicketSlaTest < ActiveSupport::TestCase
# set update time
ticket.update_attributes(
last_contact_agent: '2013-06-04 10:15:00 UTC',
last_contact_agent_at: '2013-06-04 10:15:00 UTC',
)
# set first response time
ticket.update_attributes(
first_response: '2013-06-04 10:45:00 UTC',
first_response_at: '2013-06-04 10:45:00 UTC',
)
# set ticket from 11:30 to closed
@ -1022,7 +1022,7 @@ class TicketSlaTest < ActiveSupport::TestCase
)
ticket.update_attributes(
close_time: '2013-06-04 12:00:00 UTC',
close_at: '2013-06-04 12:00:00 UTC',
)
# set sla's for timezone "Europe/Berlin" summertime (+2), so UTC times are 7:00-16:00
@ -1076,14 +1076,14 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_time 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.escalation_at.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-06-04 11:30:00 UTC', 'ticket.first_response_escalation_at verify 1')
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.update_time_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 13:40:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.close_time_in_min, 150, 'ticket.close_time_in_min verify 3')
assert_equal(ticket.close_time_diff_in_min, 100, 'ticket.close_time_diff_in_min# verify 3')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-06-04 13:40:00 UTC', 'ticket.close_escalation_at verify 1')
assert_equal(ticket.close_in_min, 150, 'ticket.close_in_min verify 3')
assert_equal(ticket.close_diff_in_min, 100, 'ticket.close_diff_in_min# verify 3')
delete = sla.destroy
assert(delete, 'sla destroy')
@ -1119,7 +1119,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_at: '2013-06-04 12:00:00 UTC',
)
ticket.update_attributes(
close_time: '2013-06-04 12:00:00 UTC',
close_at: '2013-06-04 12:00:00 UTC',
)
ticket.escalation_calculation(true)
@ -1173,14 +1173,14 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 14:00:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-06-04 14:00:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3')
assert_equal(ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 15:00:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 16:00:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.close_time_in_min, 0, 'ticket.close_time_in_min verify 3')
assert_equal(ticket.close_time_diff_in_min, 240, 'ticket.close_time_diff_in_min# verify 3')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-06-04 15:00:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-06-04 16:00:00 UTC', 'ticket.close_escalation_at verify 1')
assert_equal(ticket.close_in_min, 0, 'ticket.close_in_min verify 3')
assert_equal(ticket.close_diff_in_min, 240, 'ticket.close_diff_in_min# verify 3')
delete = sla.destroy
assert(delete, 'sla destroy')
@ -1247,7 +1247,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_at: '2013-06-04 12:00:00 UTC',
)
ticket.update_attributes(
close_time: '2013-06-04 12:00:00 UTC',
close_at: '2013-06-04 12:00:00 UTC',
)
calendar = Calendar.create_or_update(
@ -1300,14 +1300,14 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-06-04 13:30:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3')
assert_equal(ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 14:30:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 15:30:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.close_time_in_min, 30, 'ticket.close_time_in_min verify 3')
assert_equal(ticket.close_time_diff_in_min, 210, 'ticket.close_time_diff_in_min# verify 3')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-06-04 14:30:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-06-04 15:30:00 UTC', 'ticket.close_escalation_at verify 1')
assert_equal(ticket.close_in_min, 30, 'ticket.close_in_min verify 3')
assert_equal(ticket.close_diff_in_min, 210, 'ticket.close_diff_in_min# verify 3')
delete = sla.destroy
assert(delete, 'sla destroy')
@ -1390,7 +1390,7 @@ class TicketSlaTest < ActiveSupport::TestCase
updated_at: '2013-06-04 12:00:00 UTC',
)
ticket.update_attributes(
close_time: '2013-06-04 12:00:00 UTC',
close_at: '2013-06-04 12:00:00 UTC',
)
calendar = Calendar.create_or_update(
@ -1443,14 +1443,14 @@ class TicketSlaTest < ActiveSupport::TestCase
)
Scheduler.worker(true)
ticket = Ticket.find(ticket.id)
assert_equal(ticket.escalation_time, nil, 'ticket.escalation_time verify 1')
assert_equal(ticket.first_response_escal_date.gmtime.to_s, '2013-06-04 13:00:00 UTC', 'ticket.first_response_escal_date verify 1')
assert_equal(ticket.escalation_at, nil, 'ticket.escalation_at verify 1')
assert_equal(ticket.first_response_escalation_at.gmtime.to_s, '2013-06-04 13:00:00 UTC', 'ticket.first_response_escalation_at verify 1')
assert_equal(ticket.first_response_in_min, nil, 'ticket.first_response_in_min verify 3')
assert_equal(ticket.first_response_diff_in_min, nil, 'ticket.first_response_diff_in_min verify 3')
assert_equal(ticket.update_time_escal_date.gmtime.to_s, '2013-06-04 14:00:00 UTC', 'ticket.update_time_escal_date verify 1')
assert_equal(ticket.close_time_escal_date.gmtime.to_s, '2013-06-04 15:00:00 UTC', 'ticket.close_time_escal_date verify 1')
assert_equal(ticket.close_time_in_min, 60, 'ticket.close_time_in_min verify 3')
assert_equal(ticket.close_time_diff_in_min, 180, 'ticket.close_time_diff_in_min# verify 3')
assert_equal(ticket.update_escalation_at.gmtime.to_s, '2013-06-04 14:00:00 UTC', 'ticket.update_escalation_at verify 1')
assert_equal(ticket.close_escalation_at.gmtime.to_s, '2013-06-04 15:00:00 UTC', 'ticket.close_escalation_at verify 1')
assert_equal(ticket.close_in_min, 60, 'ticket.close_in_min verify 3')
assert_equal(ticket.close_diff_in_min, 180, 'ticket.close_diff_in_min# verify 3')
delete = sla.destroy
assert(delete, 'sla destroy')

View file

@ -36,11 +36,11 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 1, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound')
assert_equal(ticket.first_response, nil, 'ticket.first_response verify - inbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - inbound')
assert_equal(ticket.last_contact_at.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at, nil, 'ticket.last_contact_agent_at verify - inbound')
assert_equal(ticket.first_response_at, nil, 'ticket.first_response_at verify - inbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound')
# create inbound article #2
sleep 2
@ -61,11 +61,11 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 2, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - inbound')
assert_equal(ticket.first_response, nil, 'ticket.first_response verify - inbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - inbound')
assert_equal(ticket.last_contact_at.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at, nil, 'ticket.last_contact_agent_at verify - inbound')
assert_equal(ticket.first_response_at, nil, 'ticket.first_response_at verify - inbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - inbound')
# create note article
article_note = Ticket::Article.create(
@ -84,11 +84,11 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 3, 'ticket.article_count verify - note')
assert_equal(ticket.last_contact.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact verify - note')
assert_equal(ticket.last_contact_customer.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer verify - note')
assert_equal(ticket.last_contact_agent, nil, 'ticket.last_contact_agent verify - note')
assert_equal(ticket.first_response, nil, 'ticket.first_response verify - note')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - note')
assert_equal(ticket.last_contact_at.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact verify - note')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer_at verify - note')
assert_equal(ticket.last_contact_agent_at, nil, 'ticket.last_contact_agent_at verify - note')
assert_equal(ticket.first_response_at, nil, 'ticket.first_response_at verify - note')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - note')
# create outbound article
sleep 2
@ -108,11 +108,11 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 4, 'ticket.article_count verify - outbound')
assert_equal(ticket.last_contact.to_s, article_outbound.created_at.to_s, 'ticket.last_contact verify - outbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer verify - outbound')
assert_equal(ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - outbound')
assert_equal(ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - outbound')
assert_equal(ticket.last_contact_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact verify - outbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound1.created_at.to_s, 'ticket.last_contact_customer_at verify - outbound')
assert_equal(ticket.last_contact_agent_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent_at verify - outbound')
assert_equal(ticket.first_response_at.to_s, article_outbound.created_at.to_s, 'ticket.first_response_at verify - outbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - outbound')
# create inbound article #3
article_inbound3 = Ticket::Article.create(
@ -132,11 +132,11 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 5, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - outbound')
assert_equal(ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - outbound')
assert_equal(ticket.last_contact_at.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent_at verify - outbound')
assert_equal(ticket.first_response_at.to_s, article_outbound.created_at.to_s, 'ticket.first_response_at verify - outbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - outbound')
# create inbound article #4
sleep 2
@ -157,22 +157,22 @@ class TicketTest < ActiveSupport::TestCase
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 6, 'ticket.article_count verify - inbound')
assert_equal(ticket.last_contact.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact_customer verify - inbound')
assert_equal(ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - outbound')
assert_equal(ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - outbound')
assert_equal(ticket.close_time, nil, 'ticket.close_time verify - outbound')
assert_equal(ticket.last_contact_at.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact verify - inbound')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact_customer_at verify - inbound')
assert_equal(ticket.last_contact_agent_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent_at verify - outbound')
assert_equal(ticket.first_response_at.to_s, article_outbound.created_at.to_s, 'ticket.first_response_at verify - outbound')
assert_equal(ticket.close_at, nil, 'ticket.close_at verify - outbound')
ticket.state_id = Ticket::State.where(name: 'closed').first.id
ticket.save
ticket = Ticket.find(ticket.id)
assert_equal(ticket.article_count, 6, 'ticket.article_count verify - state update')
assert_equal(ticket.last_contact.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact verify - state update')
assert_equal(ticket.last_contact_customer.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact_customer verify - state update')
assert_equal(ticket.last_contact_agent.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent verify - state update')
assert_equal(ticket.first_response.to_s, article_outbound.created_at.to_s, 'ticket.first_response verify - state update')
assert(ticket.close_time, 'ticket.close_time verify - state update')
assert_equal(ticket.last_contact_at.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact verify - state update')
assert_equal(ticket.last_contact_customer_at.to_s, article_inbound3.created_at.to_s, 'ticket.last_contact_customer_at verify - state update')
assert_equal(ticket.last_contact_agent_at.to_s, article_outbound.created_at.to_s, 'ticket.last_contact_agent_at verify - state update')
assert_equal(ticket.first_response_at.to_s, article_outbound.created_at.to_s, 'ticket.first_response_at verify - state update')
assert(ticket.close_at, 'ticket.close_at verify - state update')
# set pending time
ticket.state_id = Ticket::State.find_by(name: 'pending reminder').id