$hotspot_delineation_result = null;
 if (isset($_SESSION['hotspot_delineation_result']) && isset($_SESSION['hotspot_delineation_result'][$objExercise->selectId()])) {
     $hotspot_delineation_result = $_SESSION['hotspot_delineation_result'][$objExercise->selectId()][$my_question_id];
 }
 if ($type == 'simple') {
     // Getting old attempt in order to decrees the total score.
     $old_result = $objExercise->manage_answer($exe_id, $my_question_id, null, 'exercise_show', array(), false, true, false, $objExercise->selectPropagateNeg(), array());
     // Removing old score.
     $total_score = $total_score - $old_result['score'];
 }
 // Deleting old attempt
 if (isset($attempt_list) && !empty($attempt_list[$my_question_id])) {
     if ($debug) {
         error_log("delete_attempt  exe_id : {$exe_id}, my_question_id: {$my_question_id}");
     }
     Event::delete_attempt($exe_id, api_get_user_id(), $course_id, $session_id, $my_question_id);
     if ($objQuestionTmp->type == HOT_SPOT) {
         Event::delete_attempt_hotspot($exe_id, api_get_user_id(), $course_id, $session_id, $my_question_id);
     }
     if (isset($attempt_list[$my_question_id]) && isset($attempt_list[$my_question_id]['marks'])) {
         $total_score -= $attempt_list[$my_question_id]['marks'];
     }
 }
 // We're inside *one* question. Go through each possible answer for this question
 $result = $objExercise->manage_answer($exe_id, $my_question_id, $my_choice, 'exercise_result', $hot_spot_coordinates, true, false, false, $objExercise->selectPropagateNeg(), $hotspot_delineation_result);
 //  Adding the new score.
 $total_score += $result['score'];
 if ($debug) {
     error_log("total_score: {$total_score} ");
     error_log("total_weight: {$total_weight} ");
 }