Fixed not working ticket overview.

This commit is contained in:
Martin Edenhofer 2012-07-30 17:16:35 +02:00
parent 3512afc5c4
commit 15f4c57356
3 changed files with 14 additions and 14 deletions

View file

@ -72,11 +72,12 @@ class App.DashboardTicket extends App.Controller
@render( data ) @render( data )
render: (data) -> render: (data) ->
@overview = data.overview @overview = data.overview
@tickets_count = data.tickets_count @tickets_count = data.tickets_count
@tickets = data.tickets @tickets = data.tickets
@ticket_list = data.ticket_list
pages_total = parseInt( ( @tickets_count / @overview.view.d.per_page ) + 0.99999 ) || 1 pages_total = parseInt( ( @tickets_count / @overview.view.d.per_page ) + 0.99999 ) || 1
html = App.view('dashboard/ticket')( html = App.view('dashboard/ticket')(
overview: @overview, overview: @overview,
@ -93,8 +94,8 @@ class App.DashboardTicket extends App.Controller
i = start i = start
while i < end while i < end
i = i + 1 i = i + 1
if @tickets[ i - 1 ] if @ticket_list[ i - 1 ]
@tickets_in_table.push @tickets[ i - 1 ] @tickets_in_table.push App.Ticket.find( @ticket_list[ i - 1 ] )
shown_all_attributes = @ticketTableAttributes( App.Overview.find(@overview.id).view.d.overview ) shown_all_attributes = @ticketTableAttributes( App.Overview.find(@overview.id).view.d.overview )
table = @table( table = @table(
@ -104,7 +105,7 @@ class App.DashboardTicket extends App.Controller
checkbox: false, checkbox: false,
) )
if _.isEmpty(@tickets) if _.isEmpty(@ticket_list)
table = '' table = ''
table = '-none-' table = '-none-'

View file

@ -48,6 +48,7 @@ class Index extends App.Controller
@overview = cache.overview @overview = cache.overview
@tickets_count = cache.tickets_count @tickets_count = cache.tickets_count
@tickets = cache.tickets @tickets = cache.tickets
@ticket_list = cache.ticket_list
@load(cache) @load(cache)
# get data # get data
@ -86,14 +87,9 @@ class Index extends App.Controller
# load ticket collection # load ticket collection
@loadCollection( type: 'Ticket', data: data.tickets ) @loadCollection( type: 'Ticket', data: data.tickets )
# remember ticket order @ticket_list_show = []
if @start_page is 1 for ticket_id in @ticket_list
@tickets = data.tickets @ticket_list_show.push App.Ticket.find(ticket_id)
else
@tickets = @tickets.concat( data.tickets )
# remember ticket count
@tickets_count = data.tickets_count
# remeber bulk attributes # remeber bulk attributes
@bulk = data.bulk @bulk = data.bulk
@ -163,7 +159,7 @@ class Index extends App.Controller
table = @table( table = @table(
overview_extended: shown_all_attributes, overview_extended: shown_all_attributes,
model: App.Ticket, model: App.Ticket,
objects: @tickets, objects: @ticket_list_show,
checkbox: true, checkbox: true,
) )

View file

@ -100,7 +100,9 @@ module Session
puts 'push overview ' + overview.meta[:url].to_s puts 'push overview ' + overview.meta[:url].to_s
users = {} users = {}
tickets = [] tickets = []
ticket_list = []
overview_data[:tickets].each {|ticket| overview_data[:tickets].each {|ticket|
ticket_list.push ticket.id
self.jobs_ticket( ticket.id, state_client_ids[client_id], tickets, users ) self.jobs_ticket( ticket.id, state_client_ids[client_id], tickets, users )
} }
@ -108,6 +110,7 @@ puts 'push overview ' + overview.meta[:url].to_s
Session.transaction( client_id, { Session.transaction( client_id, {
:data => { :data => {
:overview => overview_data[:overview], :overview => overview_data[:overview],
:ticket_list => ticket_list,
:tickets => tickets, :tickets => tickets,
:tickets_count => overview_data[:tickets_count], :tickets_count => overview_data[:tickets_count],
:users => users, :users => users,