|
|
|
@ -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)) { |
|
|
|
|