@@ -41,7 +41,7 @@ define(['marionette',
4141 e . preventDefault ( )
4242
4343 if ( app . dialog . currentView instanceof ReprocessView ) app . dialog . currentView . collection . add ( this . model )
44- else app . dialog . show ( new ReprocessView ( { model : this . model , visit : this . model . get ( 'VISIT ' ) } ) )
44+ else app . dialog . show ( new ReprocessView ( { model : this . model , visit : this . column . get ( 'visit ' ) } ) )
4545 }
4646
4747 } )
@@ -50,7 +50,6 @@ define(['marionette',
5050 initialize : function ( options ) {
5151 APItemCell . __super__ . initialize . call ( this , options )
5252 this . listenTo ( this . model , 'change reset' , this . render , this )
53- this . template = '<i class="fa fa-spin fa-spinner"></i>'
5453 } ,
5554
5655 render : function ( ) {
@@ -65,15 +64,16 @@ define(['marionette',
6564 '<i class="fa icon red fa-times alt="Failed"></i>' ]
6665
6766 var label = this . column . get ( 'program' )
68- this . $el . html ( _ . template ( this . template ) )
6967 if ( this . model . get ( 'APLOADED' ) == true ) {
70- var ap = res [ this . column . get ( 'group' ) ] [ label ]
71- var ress = { }
72- _ . each ( ap , function ( a ) {
73- if ( ! ( a in ress ) ) ress [ a ] = 0
74- ress [ a ] ++
75- } )
76- this . $el . html ( _ . map ( ress , function ( c , st ) { return c > 1 ? '<span class="count">' + c + 'x</span> ' + val [ st ] : val [ st ] } ) )
68+ if ( this . column . get ( 'group' ) in res ) {
69+ var ap = res [ this . column . get ( 'group' ) ] [ label ]
70+ var ress = { }
71+ _ . each ( ap , function ( a ) {
72+ if ( ! ( a in ress ) ) ress [ a ] = 0
73+ ress [ a ] ++
74+ } )
75+ this . $el . html ( _ . map ( ress , function ( c , st ) { return c > 1 ? '<span class="count">' + c + 'x</span> ' + val [ st ] : val [ st ] } ) )
76+ }
7777 }
7878 this . delegateEvents ( ) ;
7979 return this ;
@@ -99,7 +99,7 @@ define(['marionette',
9999 ]
100100
101101 this . columns . push . apply ( this . columns , [
102- { label : '' , cell : RPCell , template : '<a href="#" class="reprocess button button-notext" title="Reprocess"><i class="fa fa-cog"></i> <span>Reprocess</span></a>' , editable : false } ,
102+ { label : '' , cell : RPCell , template : '<a href="#" class="reprocess button button-notext" title="Reprocess"><i class="fa fa-cog"></i> <span>Reprocess</span></a>' , editable : false , visit : this . model . get ( 'VISIT' ) } ,
103103 { label : '' , cell : APCell , template : '<a href="/dc/visit/' + this . model . escape ( 'VISIT' ) + '/id/<%-ID%>" class="button button-notext dll" title="Open data collection"><i class="fa fa-arrow-right"></i> <span>Open data collection</span></a>' , editable : false } ,
104104 ] )
105105
@@ -119,7 +119,7 @@ define(['marionette',
119119
120120 updateColumns : function ( ) {
121121 var states = this . statuses . pluck ( 'STATES' )
122- var group_names = _ . keys ( states [ 0 ] )
122+ var group_names = _ . chain ( states ) . map ( _ . keys ) . flatten ( ) . uniq ( ) . value ( ) ;
123123 var groups = { }
124124 _ . each ( group_names , function ( group ) {
125125 groups [ group ] = _ . unique ( _ . map ( states , function ( state ) { return _ . keys ( state [ group ] ) } ) . flat ( ) )
@@ -159,4 +159,4 @@ define(['marionette',
159159 this . wrap . show ( this . table )
160160 }
161161 } )
162- } )
162+ } )
0 commit comments