#NEWLINE# def _revert_assignment_from_audit( assignment_audit ) : #NEWLINE# #INDENT# assignment = TaskAssignment . objects . get ( id = assignment_audit [ 'assignment' ] [ 'id' ] ) #NEWLINE# if ( assignment_audit [ 'change' ] == RevertChange . DELETED . value ) : #NEWLINE# #INDENT# assignment . delete ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( assignment_audit [ 'change' ] == RevertChange . REVERTED . value ) : #NEWLINE# #INDENT# for iteration_audit in assignment_audit [ 'iterations' ] : #NEWLINE# #INDENT# _revert_iteration_from_audit ( iteration_audit ) #NEWLINE# #UNINDENT# assignment . refresh_from_db ( ) #NEWLINE# if ( get_latest_iteration ( assignment ) . status == Iteration . Status . PROCESSING ) : #NEWLINE# #INDENT# assignment . status = TaskAssignment . Status . PROCESSING #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assignment . status = TaskAssignment . Status . SUBMITTED #NEWLINE# #UNINDENT# assignment . save ( ) #NEWLINE# #UNINDENT# #UNINDENT# return assignment