def my_update_subtask_status(entry_id, current_task_id, new_subtask_status):
 entry = InstructorTask.objects.get(pk=entry_id)
 subtask_dict = json.loads(entry.subtasks)
 subtask_status_info = subtask_dict['status']
 current_subtask_status = SubtaskStatus.from_dict(subtask_status_info[current_task_id])
 current_retry_count = current_subtask_status.get_retry_count()
 new_retry_count = new_subtask_status.get_retry_count()
 if (current_retry_count <= new_retry_count):
  update_subtask_status(entry_id, current_task_id, new_subtask_status)

def my_update_subtask_status ( entry_id , current_task_id , new_subtask_status ) : entry = InstructorTask . objects . get ( pk = entry_id ) subtask_dict = json . loads ( entry . subtasks ) subtask_status_info = subtask_dict [ 'status' ] current_subtask_status = SubtaskStatus . from_dict ( subtask_status_info [ current_task_id ] ) current_retry_count = current_subtask_status . get_retry_count ( ) new_retry_count = new_subtask_status . get_retry_count ( ) if ( current_retry_count <= new_retry_count ) : update_subtask_status ( entry_id , current_task_id , new_subtask_status )
check whether a subtask has been updated before really updating .