Learnpath - Improve Lp requisites with quiz attempts - refs BT#19599

pull/4149/head
Christian 4 years ago
parent 1d97cb1d23
commit ad980cc9fb
  1. 30
      main/lp/learnpathItem.class.php

@ -2342,6 +2342,13 @@ class learnpathItem
$status = $itemToCheck->get_status(true); $status = $itemToCheck->get_status(true);
$returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3]; $returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3];
// 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;
}
}
if (!$returnstatus) { if (!$returnstatus) {
$explanation = sprintf( $explanation = sprintf(
get_lang('ItemXBlocksThisElement'), get_lang('ItemXBlocksThisElement'),
@ -2403,14 +2410,6 @@ class learnpathItem
$returnstatus = false; $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 { } else {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
$returnstatus = false; $returnstatus = false;
@ -2469,14 +2468,6 @@ class learnpathItem
$returnstatus = false; $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 { } else {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
@ -2494,6 +2485,13 @@ class learnpathItem
$refs_list $refs_list
); );
} }
// 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;
}
}
} }
return $returnstatus; return $returnstatus;

Loading…
Cancel
Save