#NEWLINE# def get_ordered_snapshots( task ) : #NEWLINE# #INDENT# task_snapshots = [ ] #NEWLINE# for assignment in task . assignments . all ( ) : #NEWLINE# #INDENT# assignment_snapshots = assignment . snapshots . get ( 'snapshots' ) #NEWLINE# if ( assignment_snap_index is None ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# for ( assignment_snap_index , snapshot ) in enumerate ( assignment_snapshots ) : #NEWLINE# #INDENT# snapshot [ 'assignment' ] = assignment #NEWLINE# snapshot [ 'assignment_snap_index' ] = assignment_snap_index #NEWLINE# task_snapshots . append ( snapshot ) #NEWLINE# #UNINDENT# #UNINDENT# return sorted ( task_snapshots , key = itemgetter ( 'datetime' ) )