Skip to content

Commit

Permalink
Quiz: Fix hotspot score with controlled time quiz within lp - refs BT…
Browse files Browse the repository at this point in the history
…#18623 #3835
  • Loading branch information
AngelFQC committed Mar 31, 2021
1 parent cc9cb13 commit 0ba1ee5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
22 changes: 18 additions & 4 deletions main/exercise/exercise.class.php
Expand Up @@ -5818,7 +5818,11 @@ public function manage_answer(
$quesId,
1,
$hotspotValue,
$exerciseResultCoordinates[$quesId]
$exerciseResultCoordinates[$quesId],
false,
0,
$learnpath_id,
$learnpath_item_id
);
} else {
if ($final_answer == 0) {
Expand All @@ -5832,7 +5836,11 @@ public function manage_answer(
$quesId,
$idx,
0,
$val
$val,
false,
0,
$learnpath_id,
$learnpath_item_id
);
}
}
Expand All @@ -5846,7 +5854,11 @@ public function manage_answer(
$quesId,
$idx,
$hotspotValue,
$val
$val,
false,
0,
$learnpath_id,
$learnpath_item_id
);
}
}
Expand Down Expand Up @@ -6111,7 +6123,9 @@ public function manage_answer(
$hotspotValue,
$val,
false,
$this->id
$this->id,
$learnpath_id,
$learnpath_item_id
);
}
} else {
Expand Down
7 changes: 4 additions & 3 deletions main/inc/lib/events.lib.php
Expand Up @@ -725,14 +725,15 @@ public static function saveExerciseAttemptHotspot(
$correct,
$coords,
$updateResults = false,
$exerciseId = 0
$exerciseId = 0,
$lpId = 0,
$lpItemId = 0
) {
$debug = false;
global $safe_lp_id, $safe_lp_item_id;

if ($updateResults == false) {
// Validation in case of fraud with activated control time
if (!ExerciseLib::exercise_time_control_is_valid($exerciseId, $safe_lp_id, $safe_lp_item_id)) {
if (!ExerciseLib::exercise_time_control_is_valid($exerciseId, $lpId, $lpItemId)) {
if ($debug) {
error_log('Attempt is fraud');
}
Expand Down

0 comments on commit 0ba1ee5

Please sign in to comment.