Merge pull request #3957 from christianbeeznest/BT19079

Lp: Implement to use the best result of a quiz in lp - refs BT19079
pull/3973/head
Angel Fernando Quiroz Campos 5 years ago committed by GitHub
commit 544dff6bd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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