Learnpath - Improve allow lp prerequisite on quiz to unblock if max attempt is reached - refs BT#19599

pull/4149/head
Christian 4 years ago
parent 9ee1a2d134
commit 1d97cb1d23
  1. 2
      main/install/configuration.dist.php
  2. 15
      main/lp/learnpathItem.class.php

@ -2097,7 +2097,7 @@ INSERT INTO `extra_field` (`extra_field_type`, `field_type`, `variable`, `displa
];*/
// Allow learnpath prerequisite on quiz to unblock if maximum attempt is reached
//$_configuration['lp_prerequisit_on quiz_unblock_if_max_attempt_reached'] = false;
//$_configuration['lp_prerequisit_on_quiz_unblock_if_max_attempt_reached'] = false;
// KEEP THIS AT THE END
// -------- Custom DB changes

@ -2404,8 +2404,8 @@ class learnpathItem
}
}
// Allow learnpath prerequisite on quiz to unblock if maximum attempt is reached
if (true === api_get_configuration_value('lp_prerequisit_on quiz_unblock_if_max_attempt_reached')) {
$isQuizMaxAttemptReached = $this->isQuizMaxAttemptReached($items[$refs_list[$prereqs_string]]->path, $user_id,$courseId, $this->lp_id, $prereqs_string);
if (true === api_get_configuration_value('lp_prerequisit_on_quiz_unblock_if_max_attempt_reached')) {
$isQuizMaxAttemptReached = $this->isQuizMaxAttemptReached($items[$refs_list[$prereqs_string]]->path, $user_id, $courseId, $this->lp_id, $prereqs_string);
if ($isQuizMaxAttemptReached) {
$returnstatus = true;
}
@ -2469,6 +2469,14 @@ class learnpathItem
$returnstatus = false;
}
}
// Allow learnpath prerequisite on quiz to unblock if maximum attempt is reached
if (true === api_get_configuration_value('lp_prerequisit_on_quiz_unblock_if_max_attempt_reached')) {
$isQuizMaxAttemptReached = $this->isQuizMaxAttemptReached($items[$refs_list[$prereqs_string]]->path, $user_id, $courseId, $this->lp_id, $prereqs_string);
if ($isQuizMaxAttemptReached) {
$returnstatus = true;
}
}
}
} else {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
@ -2668,8 +2676,7 @@ class learnpathItem
api_get_session_id()
);
$isMaxAttemptReached = ($nbAttempts > 0 && $nbAttempts == $countAttempts);
$isMaxAttemptReached = ($nbAttempts > 0 && $countAttempts >= $nbAttempts);
return $isMaxAttemptReached;
}

Loading…
Cancel
Save