@outer_atomic
def reset_attempts_module_state(xmodule_instance_args, _module_descriptor, student_module, _task_input):
 update_status = UPDATE_STATUS_SKIPPED
 problem_state = (json.loads(student_module.state) if student_module.state else {})
 if ('attempts' in problem_state):
  old_number_of_attempts = problem_state['attempts']
  if (old_number_of_attempts > 0):
   problem_state['attempts'] = 0
   student_module.state = json.dumps(problem_state)
   student_module.save()
   track_function = _get_track_function_for_task(student_module.student, xmodule_instance_args)
   event_info = {'old_attempts': old_number_of_attempts, 'new_attempts': 0}
   track_function('problem_reset_attempts', event_info)
   update_status = UPDATE_STATUS_SUCCEEDED
 return update_status

@ outer_atomic def reset_attempts_module_state ( xmodule_instance_args , _module_descriptor , student_module , _task_input ) : update_status = UPDATE_STATUS_SKIPPED problem_state = ( json . loads ( student_module . state ) if student_module . state else { } ) if ( 'attempts' in problem_state ) : old_number_of_attempts = problem_state [ 'attempts' ] if ( old_number_of_attempts > 0 ) : problem_state [ 'attempts' ] = 0 student_module . state = json . dumps ( problem_state ) student_module . save ( ) track_function = _get_track_function_for_task ( student_module . student , xmodule_instance_args ) event_info = { 'old_attempts' : old_number_of_attempts , 'new_attempts' : 0 } track_function ( 'problem_reset_attempts' , event_info ) update_status = UPDATE_STATUS_SUCCEEDED return update_status
resets problem attempts to zero for specified student_module .