Lp: Implement to use the best result of a quiz in lp - refs BT19079

pull/3957/head
Christian 4 years ago
parent 88b3cce95b
commit 8c44368bcd
  1. 2
      main/install/configuration.dist.php
  2. 4
      main/lp/learnpathItem.class.php

@ -263,6 +263,8 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
//$_configuration['lp_replace_http_to_https'] = false;
// Fix embedded videos inside lps, adding an optional popup
//$_configuration['lp_fix_embed_content'] = false;
// Check the prerequisite in lp of a quiz to use only the last score in the attempts
// $_configuration['lp_prerequisite_use_last_attempt_only'] = false;
// Manage deleted files marked with "DELETED" (by course and only by allowed by admin)
//$_configuration['document_manage_deleted_files'] = false;
// Hide tabs in the main/session/index.php page

@ -2354,6 +2354,8 @@ class learnpathItem
if ($this->prevent_reinit == 1) {
// 2. If is completed we check the results in the DB of the quiz.
if ($returnstatus) {
$checkLastScoreAttempt = api_get_configuration_value('lp_prerequisite_use_last_attempt_only');
$orderBy = ($checkLastScoreAttempt?'ORDER BY exe_date DESC':'ORDER BY (exe_result/exe_weighting) DESC');
$sql = 'SELECT exe_result, exe_weighting
FROM '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES).'
WHERE
@ -2363,7 +2365,7 @@ class learnpathItem
orig_lp_item_id = '.$prereqs_string.' AND
status <> "incomplete" AND
c_id = '.$courseId.'
ORDER BY exe_date DESC
'.$orderBy.'
LIMIT 0, 1';
$rs_quiz = Database::query($sql);
if ($quiz = Database::fetch_array($rs_quiz)) {

Loading…
Cancel
Save