Improved reload trigger if somebody else changed ticket.

This commit is contained in:
Martin Edenhofer 2014-04-04 11:24:16 +02:00
parent ac12b98c9e
commit 075aade8a8

View file

@ -27,9 +27,8 @@ class App.TicketZoom extends App.Controller
(data) => (data) =>
update = => update = =>
if data.id.toString() is @ticket_id.toString() if data.id.toString() is @ticket_id.toString()
ticket = App.Ticket.find( @ticket_id ) @log 'notice', 'TRY', new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall)
@log 'notice', 'TRY', Date(data.updated_at), Date(ticket.updated_at) if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() )
if Date(data.updated_at) isnt Date(ticket.updated_at)
@fetch( @ticket_id, false ) @fetch( @ticket_id, false )
@delay( update, 1800, 'ticket-zoom-' + @ticket_id ) @delay( update, 1800, 'ticket-zoom-' + @ticket_id )
) )