Fixed ticket reload on server change.

This commit is contained in:
Martin Edenhofer 2015-02-01 12:43:59 +01:00
parent 0f8c093bec
commit 392dd59dc4

View file

@ -34,12 +34,16 @@ class App.TicketZoom extends App.Controller
@bind( @bind(
'Ticket:update' 'Ticket:update'
(data) => (data) =>
update = =>
if data.id.toString() is @ticket_id.toString() # check if current ticket has changed
@log 'notice', 'TRY', new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall) if data.id.toString() is @ticket_id.toString()
if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() )
@fetch( @ticket_id, false ) # check if we already have the request queued
@delay( update, 1800, 'ticket-zoom-' + @ticket_id ) #@log 'notice', 'TRY', @ticket_id, new Date(data.updated_at), new Date(@ticketUpdatedAtLastCall)
update = =>
@fetch( @ticket_id, false )
if !@ticketUpdatedAtLastCall || ( new Date(data.updated_at).toString() isnt new Date(@ticketUpdatedAtLastCall).toString() )
@delay( update, 1800, 'ticket-zoom-' + @ticket_id )
) )
meta: => meta: =>
@ -264,7 +268,6 @@ class App.TicketZoom extends App.Controller
) )
show = (ticket) => show = (ticket) =>
console.log('SHOW', ticket.id)
el.find('.edit').html('') el.find('.edit').html('')
defaults = ticket.attributes() defaults = ticket.attributes()