Fix LP/exercise prerequisite update see BT#13393

Use "prerequisites_match" instead of use custom  prereq verification
pull/2487/head
jmontoyaa 7 years ago
parent d7876b3558
commit 2c6e8f8c97
  1. 15
      main/exercise/exercise_report.php

@ -192,7 +192,6 @@ if (isset($_REQUEST['comments']) &&
'teacher_comment' => $my_comments
];
Database::update(
$TBL_TRACK_ATTEMPT,
$params,
@ -247,12 +246,22 @@ if (isset($_REQUEST['comments']) &&
}
// Updating LP score here
if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp'))) {
if (in_array($origin, array('tracking_course', 'user_course', 'correct_exercise_in_lp', 'tracking'))) {
$statusCondition = '';
$item = new learnpathItem($lpItemId, api_get_user_id(), api_get_course_int_id());
if ($item) {
$prereqId = $item->get_prereq_string();
$minScore = $item->getPrerequisiteMinScore();
$maxScore = $item->getPrerequisiteMaxScore();
$passed = false;
$lp = new learnpath(api_get_course_id(), $lp_id, $student_id);
$prereqCheck = $lp->prerequisites_match($lpItemId);
if ($prereqCheck) {
$passed = true;
}
/*$minScore = $item->getPrerequisiteMinScore();
$maxScore = $item->getPrerequisiteMaxScore();
$passed = false;
// Check lp item min/max
@ -260,7 +269,7 @@ if (isset($_REQUEST['comments']) &&
if ($tot >= $minScore && $tot <= $maxScore) {
$passed = true;
}
}
}*/
if ($passed == false) {
if (!empty($objExerciseTmp->pass_percentage)) {

Loading…
Cancel
Save