Fixed first response detection.
This commit is contained in:
parent
9d6b313601
commit
e3277a3b8a
2 changed files with 30 additions and 7 deletions
|
@ -34,7 +34,7 @@ class Observer::Ticket::ArticleChanges < ActiveRecord::Observer
|
|||
# if sender is not agent
|
||||
sender = Ticket::Article::Sender.lookup(id: record.sender_id)
|
||||
type = Ticket::Article::Type.lookup(id: record.type_id)
|
||||
return true if sender.name != 'Agent' && type.name !~ /^phone/
|
||||
return true if sender.name != 'Agent'
|
||||
|
||||
# if article is a message to customer
|
||||
return true if !type.communication
|
||||
|
|
|
@ -394,7 +394,30 @@ class TicketSlaTest < ActiveSupport::TestCase
|
|||
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.to_s, article_inbound.created_at.to_s, 'ticket.first_response verify - inbound' )
|
||||
assert_equal( ticket.first_response, nil, 'ticket.first_response verify - inbound' )
|
||||
assert_equal( ticket.close_time, nil, 'ticket.close_time verify - inbound' )
|
||||
|
||||
# create outbound article
|
||||
article_outbound = Ticket::Article.create(
|
||||
ticket_id: ticket.id,
|
||||
from: 'some_sender@example.com',
|
||||
subject: 'some subject',
|
||||
message_id: 'some@id',
|
||||
body: 'some message',
|
||||
internal: false,
|
||||
sender: Ticket::Article::Sender.where(name: 'Agent').first,
|
||||
type: Ticket::Article::Type.where(name: 'phone').first,
|
||||
updated_by_id: 1,
|
||||
created_by_id: 1,
|
||||
created_at: '2013-03-28 23:55:00 UTC',
|
||||
updated_at: '2013-03-28 23:55:00 UTC',
|
||||
)
|
||||
ticket = Ticket.find(ticket.id)
|
||||
assert_equal( ticket.article_count, 2, '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' )
|
||||
|
||||
delete = sla.destroy
|
||||
|
|
Loading…
Reference in a new issue