Fix LP Final Item when it showing the certificate and badges if you fail an exercise

remotes/angel/1.11.x
José Loguercio 9 years ago
parent 1a69e4b4c7
commit 1db35954cc
  1. 10
      main/newscorm/learnpath.class.php
  2. 2
      main/newscorm/lp_final_item.php

@ -1686,9 +1686,10 @@ class learnpath
/**
* Gets the number of items currently completed
* @param bool $failedStatusException flag to determine the failed status is not considered progressed
* @return integer The number of items currently completed
*/
public function get_complete_items_count()
public function get_complete_items_count($failedStatusException = false)
{
if ($this->debug > 0) {
error_log('New LP - In learnpath::get_complete_items_count()', 0);
@ -1698,10 +1699,13 @@ class learnpath
'completed',
'passed',
'succeeded',
'browsed',
'failed'
'browsed'
);
if (!$failedStatusException) {
$completedStatusList[] = 'failed';
}
foreach ($this->items as $id => $dummy) {
// Trying failed and browsed considered "progressed" as well.
if ($this->items[$id]->status_is($completedStatusList) &&

@ -35,7 +35,7 @@ $finalItemTemplate = '';
// Check prerequisites and total completion of the learning path
$lp = new Learnpath($courseCode, $lpId, $userId);
$count = $lp->get_total_items_count_without_chapters();
$completed = $lp->get_complete_items_count();
$completed = $lp->get_complete_items_count(true);
$currentItemId = $lp->get_current_item_id();
$currentItem = $lp->items[$currentItemId];
$currentItemStatus = $currentItem->get_status();

Loading…
Cancel
Save