From 6dc879ea4848833f5b3dfac0ab50bb58b09e75df Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 08:56:24 +0200
Subject: [PATCH 1/9] Fix export csv see BT#10895

---
 main/glossary/index.php         | 16 ++++++++++------
 main/inc/lib/export.lib.inc.php |  2 +-
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/main/glossary/index.php b/main/glossary/index.php
index 3e8a51690e..11d9d2d264 100755
--- a/main/glossary/index.php
+++ b/main/glossary/index.php
@@ -198,10 +198,8 @@ switch ($action) {
         );
         $form->addElement('header', '', get_lang('ImportGlossary'));
         $form->addElement('file', 'file', get_lang('ImportCSVFileLocation'));
-
         $form->addElement('checkbox', 'replace', null, get_lang('DeleteAllGlossaryTerms'));
         $form->addElement('checkbox', 'update', null, get_lang('UpdateExistingGlossaryTerms'));
-
         $form->addButtonImport(get_lang('Import'), 'SubmitImport');
         $content = $form->returnForm();
 
@@ -316,13 +314,19 @@ switch ($action) {
 
             if (count($badList) > 0) {
                 Display::addFlash(
-                    Display::return_message(get_lang("GlossaryTermAlreadyExists").': ' . implode(', ', $badList), 'error')
+                    Display::return_message(
+                        get_lang("GlossaryTermAlreadyExists").': ' . implode(', ', $badList),
+                        'error'
+                    )
                 );
             }
 
             if (count($doubles) > 0) {
                 Display::addFlash(
-                    Display::return_message(get_lang("TermsDuplicatedInFile").': '.implode(', ', $doubles), 'warning')
+                    Display::return_message(
+                        get_lang("TermsDuplicatedInFile").': '.implode(', ', $doubles),
+                        'warning'
+                    )
                 );
             }
 
@@ -343,9 +347,9 @@ switch ($action) {
 
         usort($data, "sorter");
         $list = array();
-        $list[] = array('term','definition');
+        $list[] = array('term', 'definition');
         foreach ($data as $line) {
-            $list[] = array ($line[0], $line[1]);
+            $list[] = array($line[0], $line[1]);
         }
         $filename = 'glossary_course_'.api_get_course_id();
         Export::arrayToCsv($list, $filename);
diff --git a/main/inc/lib/export.lib.inc.php b/main/inc/lib/export.lib.inc.php
index 2ad3c33027..fc3354a236 100755
--- a/main/inc/lib/export.lib.inc.php
+++ b/main/inc/lib/export.lib.inc.php
@@ -43,7 +43,6 @@ class Export
     public static function arrayToCsv($data, $filename = 'export')
     {
         if (empty($data)) {
-
             return false;
         }
 
@@ -53,6 +52,7 @@ class Export
         $writer->setStream(fopen($filePath, 'w'));
 
         foreach ($data as $item) {
+            $item = array_map('trim', $item);
             $writer->writeItem($item);
         }
         $writer->finish();

From 9662c3741e0b1f5e4e535a85ad53f29831a766bc Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 12:26:27 +0200
Subject: [PATCH 2/9] Fix error where teacher cannot correct exam see BT#11759

---
 main/exercise/exercise_show.php | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/main/exercise/exercise_show.php b/main/exercise/exercise_show.php
index af8af14456..694568bf3a 100755
--- a/main/exercise/exercise_show.php
+++ b/main/exercise/exercise_show.php
@@ -208,7 +208,7 @@ if (!empty($track_exercise_info)) {
         if ($result_disabled == RESULT_DISABLE_NO_SCORE_AND_EXPECTED_ANSWERS) {
             $show_results = false;
             if ($origin != 'learnpath') {
-                echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
+                /*echo '<table width="100%" border="0" cellspacing="0" cellpadding="0">
                       <tr>
                         <td colspan="2">';
                 Display::display_warning_message(
@@ -217,7 +217,7 @@ if (!empty($track_exercise_info)) {
                 );
                 echo '</td>
                 </tr>
-                </table>';
+                </table>';*/
             }
         } elseif ($result_disabled == RESULT_DISABLE_SHOW_SCORE_ONLY) {
             $show_results = false;
@@ -262,6 +262,10 @@ if ($origin == 'learnpath' && !isset($_GET['fb_type'])) {
     $show_results = false;
 }
 
+if ($is_allowedToEdit && in_array($action, ['qualify', 'edit'])) {
+    $show_results = true;
+}
+
 if ($show_results || $show_only_total_score || $showTotalScoreAndUserChoices) {
     $user_info = api_get_user_info($student_id);
     //Shows exercise header

From 7373961cd82568dfc6b9bae053e2850ad9bc39c1 Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 13:41:42 +0200
Subject: [PATCH 3/9] Minor - format code

---
 src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php
index cec10d2237..c2c8d1de41 100644
--- a/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php
+++ b/src/Chamilo/CoreBundle/Component/Utils/ChamiloApi.php
@@ -129,13 +129,15 @@ class ChamiloApi
 
         return \Display::url($image, api_get_path(WEB_PATH) . 'index.php');
     }
+
     /**
      * Like strip_tags(), but leaves an additional space and removes only the given tags
      * @param string $string
      * @param array $tags Tags to be removed
      * @return  string The original string without the given tags
      */
-    public static function stripGivenTags($string, $tags) {
+    public static function stripGivenTags($string, $tags)
+    {
         foreach ($tags as $tag) {
             $string2 = preg_replace('#</' . $tag . '[^>]*>#i', ' ', $string);
             if ($string2 != $string) {

From b362d92fe29ea14e878cd5b0f4841fbd78ba79f3 Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 13:43:50 +0200
Subject: [PATCH 4/9] format code

---
 tests/datafiller/data_courses.php    |  2 +-
 tests/datafiller/data_users.php      |  6 +--
 tests/datafiller/fill_all.php        | 29 +++++++-------
 tests/datafiller/fill_many_users.php | 59 +++++++++++++++++++---------
 tests/datafiller/fill_users.php      |  6 +--
 5 files changed, 60 insertions(+), 42 deletions(-)

diff --git a/tests/datafiller/data_courses.php b/tests/datafiller/data_courses.php
index 590cc742b6..b0fb3b60ba 100755
--- a/tests/datafiller/data_courses.php
+++ b/tests/datafiller/data_courses.php
@@ -130,6 +130,6 @@ $courses[] = array(
     'course_language' => 'english',
     'user_id' => 1,
     'expiration_date' => '2020-09-01 00:00:00',
-    'exemplary_content' => true,
+    'exemplary_content' => true
 );
 
diff --git a/tests/datafiller/data_users.php b/tests/datafiller/data_users.php
index e754ed2626..e62a0208ac 100755
--- a/tests/datafiller/data_users.php
+++ b/tests/datafiller/data_users.php
@@ -1,4 +1,4 @@
-<?php //$id$
+<?php
 /**
  * This script contains the data to fill (or empty) the database with using
  * the fillers in this directory.
@@ -7,9 +7,7 @@
  * @author Yannick Warnier <yannick.warnier@dokeos.com>
  *
  */
-/**
- * Initialisation section
- */
+
 $users = array();
 $users[] = array(
     'username' => 'ywarnier',
diff --git a/tests/datafiller/fill_all.php b/tests/datafiller/fill_all.php
index 484a003574..0bbc2bd62f 100755
--- a/tests/datafiller/fill_all.php
+++ b/tests/datafiller/fill_all.php
@@ -1,4 +1,4 @@
-<?php //$id$
+<?php
 /**
  * This script contains calls to the various filling scripts that allow a
  * demo presenter to fill his Dokeos with demo data.
@@ -8,11 +8,8 @@
  * on your system and t launch this script manually using: php5 fill_all.php
  * @author Yannick Warnier <yannick.warnier@dokeos.com>
  */
- 
-/**
- * Initialisation section
- */
-$incdir = dirname(__FILE__).'/../../main/inc/'; 
+
+$incdir = dirname(__FILE__).'/../../main/inc/';
 require $incdir.'global.inc.php';
 
 /**
@@ -24,23 +21,25 @@ $eol = PHP_EOL;
 $output = '';
 $files = scandir(dirname(__FILE__));
 foreach ($files as $file) {
-	if (substr($file,0,1) == '.' or substr($file,0,5) != 'fill_') { ; } //skip
-    else {    	
-    	if ($file == basename(__FILE__)) {
-    		//skip, this is the current file
-    	} else {
+    if (substr($file, 0, 1) == '.' or substr($file, 0, 5) != 'fill_') {
+        ;
+    } else {
+        if ($file == basename(__FILE__)) {
+            //skip, this is the current file
+        } else {
             $output .= $eol.'Reading file: '.$file.$eol;
-    		require_once $file;
-            $function = basename($file,'.php');
+            require_once $file;
+            $function = basename($file, '.php');
             if (function_exists($function)) {
-            	$output .= $eol.'Executing function '.$function.$eol;
+                $output .= $eol.'Executing function '.$function.$eol;
                 $function();
             } else {
                 //function not found
             }
-    	}
+        }
     }
 }
+
 /**
  * Display
  */
diff --git a/tests/datafiller/fill_many_users.php b/tests/datafiller/fill_many_users.php
index ba00185304..d4a745eba6 100755
--- a/tests/datafiller/fill_many_users.php
+++ b/tests/datafiller/fill_many_users.php
@@ -1,38 +1,61 @@
-<?php //$id$
+<?php
 /**
  * This script contains a data filling procedure for users
  * @author Yannick Warnier <yannick.warnier@beeznest.com>
  *
  */
-/**
- * Initialisation section
- */
+
 require '../../main/inc/global.inc.php';
+
 /**
  * Executing
  */
-fill_many_users(100000);
+//fill_many_users(100000);
+
 /**
  * Loads the data and injects it into the Chamilo database, using the Chamilo
  * internal functions.
  * @return  array  List of user IDs for the users that have just been inserted
  */
-function fill_many_users($num) {
-	$eol = PHP_EOL;
+function fill_many_users($num)
+{
     $users = array(); //declare only to avoid parsing notice
     require_once 'data_users.php'; //fill the $users array
     $i = 1;
+    $output = [];
+
+    $batchSize = 20;
+    $em = Database::getManager();
+
     while ($i < $num) {
-      $output = array();
-      $output[] = array('title'=>'Users Filling Report:');
-      foreach ($users as $j => $user) {
-        //first check that the first item doesn't exist already
-    	$output[$i]['line-init'] = $user['firstname'];
-        $res = UserManager::create_user($user['firstname'],$user['lastname'],$user['status'],$user['email'],$user['username'].$i,$user['pass'],null,null,null,null,$user['auth_source'],null,$user['active']);
-    	$output[$i]['line-info'] = ($res ? get_lang('Inserted') : get_lang('NotInserted')).' '.$user['username'].$i;
-    	$i++;
-      }
-      print_r($output);
+        $output[] = array('title' => 'Users Filling Report:');
+        foreach ($users as $j => $user) {
+            //first check that the first item doesn't exist already
+            $output[$i]['line-init'] = $user['firstname'];
+            $res = UserManager::create_user(
+                $user['firstname'],
+                $user['lastname'],
+                $user['status'],
+                $i.'_'.$user['email'],
+                $i.'_'.$user['username'],
+                $user['pass'],
+                null,
+                null,
+                null,
+                null,
+                $user['auth_source'],
+                null,
+                $user['active']
+            );
+            $output[$i]['line-info'] = ($res ? get_lang('Inserted') : get_lang('NotInserted')).' '.$user['username'].$i;
+            $i++;
+
+            if (($i % $batchSize) === 0) {
+                $em->flush();
+                $em->clear(); // Detaches all objects from Doctrine!
+            }
+        }
     }
-    //return $output;
+
+    return $output;
 }
diff --git a/tests/datafiller/fill_users.php b/tests/datafiller/fill_users.php
index 0b32fa97e1..1f086d0cd1 100755
--- a/tests/datafiller/fill_users.php
+++ b/tests/datafiller/fill_users.php
@@ -1,12 +1,10 @@
-<?php //$id$
+<?php
+
 /**
  * This script contains a data filling procedure for users
  * @author Yannick Warnier <yannick.warnier@beeznest.com>
  *
  */
-/**
- * Initialisation section
- */
 
 /**
  * Loads the data and injects it into the Chamilo database, using the Chamilo

From 1be243e2a67178856f5ac20c6e02e39f337f7747 Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 13:55:53 +0200
Subject: [PATCH 5/9] Fix PHP warnings

---
 main/exercise/exercise.php | 22 +++++++++++++---------
 main/inc/lib/api.lib.php   | 12 +++++++-----
 2 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/main/exercise/exercise.php b/main/exercise/exercise.php
index 3cd4d99aed..651d4f6a37 100644
--- a/main/exercise/exercise.php
+++ b/main/exercise/exercise.php
@@ -563,6 +563,8 @@ if (isset($list_ordered) && !empty($list_ordered)) {
     $exercise_list = $new_question_list;
 }
 
+$tableRows = [];
+
 /*  Listing exercises  */
 if (!empty($exercise_list)) {
     if ($origin != 'learnpath') {
@@ -895,13 +897,13 @@ if (!empty($exercise_list)) {
                 // Don't remove this marker: note-query-exe-results
                 $sql = "SELECT * FROM $TBL_TRACK_EXERCISES
                         WHERE
-                            exe_exo_id      = ".$row['id']." AND
-                            exe_user_id     = ".$userId." AND
-                            c_id    = ".api_get_course_int_id()." AND
-                            status          <> 'incomplete' AND
-                            orig_lp_id      = 0 AND
+                            exe_exo_id = ".$row['id']." AND
+                            exe_user_id = $userId AND
+                            c_id = ".api_get_course_int_id()." AND
+                            status <> 'incomplete' AND
+                            orig_lp_id = 0 AND
                             orig_lp_item_id = 0 AND
-                            session_id      =  '".api_get_session_id()."'
+                            session_id =  '".api_get_session_id()."'
                         ORDER BY exe_id DESC";
 
                 $qryres = Database::query($sql);
@@ -967,7 +969,10 @@ if (!empty($exercise_list)) {
                         if ($num > 0) {
                             $row_track = Database :: fetch_array($qryres);
                             $attempt_text = get_lang('LatestAttempt').' : ';
-                            $attempt_text .= ExerciseLib::show_score($row_track['exe_result'], $row_track['exe_weighting']);
+                            $attempt_text .= ExerciseLib::show_score(
+                                $row_track['exe_result'],
+                                $row_track['exe_weighting']
+                            );
                         } else {
                             $attempt_text = get_lang('NotAttempted');
                         }
@@ -1012,8 +1017,7 @@ if (!empty($exercise_list)) {
                     'id' => 'exercise_list_' . $my_exercise_id,
                 )
             );
-
-        } // end foreach()
+        }
     }
 }
 
diff --git a/main/inc/lib/api.lib.php b/main/inc/lib/api.lib.php
index 70b987e20b..8491a6a36f 100644
--- a/main/inc/lib/api.lib.php
+++ b/main/inc/lib/api.lib.php
@@ -5045,7 +5045,7 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
         // Found item for this access_url.
         $row = Database::fetch_array($res);
         $sql = "UPDATE $t_settings SET selected_value = '$value'
-                WHERE id = ".$row['id'] ;
+                WHERE id = ".$row['id'];
         Database::query($sql);
     } else {
         // Item not found for this access_url, we have to check if it exist with access_url = 1
@@ -5071,8 +5071,9 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
                         "".(!empty($row['comment']) ? "'".$row['comment']."'" : "NULL").",".(!empty($row['scope']) ? "'".$row['scope']."'" : "NULL")."," .
                         "".(!empty($row['subkeytext'])?"'".$row['subkeytext']."'":"NULL").",$access_url)";
                 Database::query($insert);
-            } else { // Such a setting does not exist.
-                error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0);
+            } else {
+                // Such a setting does not exist.
+                //error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all', 0);
             }
         } else {
             // Other access url.
@@ -5084,7 +5085,8 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
             }
             $res = Database::query($select);
 
-            if (Database::num_rows($res) > 0) { // We have a setting for access_url 1, but none for the current one, so create one.
+            if (Database::num_rows($res) > 0) {
+                // We have a setting for access_url 1, but none for the current one, so create one.
                 $row = Database::fetch_array($res);
                 if ($row['access_url_changeable'] == 1) {
                     $insert = "INSERT INTO $t_settings (variable,subkey, type,category, selected_value,title, comment,scope, subkeytext,access_url, access_url_changeable) VALUES
@@ -5098,7 +5100,7 @@ function api_set_setting($var, $value, $subvar = null, $cat = null, $access_url
                     Database::query($insert);
                 }
             } else { // Such a setting does not exist.
-                error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0);
+                //error_log(__FILE__.':'.__LINE__.': Attempting to update setting '.$var.' ('.$subvar.') which does not exist at all. The access_url is: '.$access_url.' ',0);
             }
         }
     }

From 2673830c0eb5789bfcfb9bc18fba3305839628bb Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 14:15:31 +0200
Subject: [PATCH 6/9] Fix folder creation

---
 main/document/document.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/document/document.php b/main/document/document.php
index ce554c9fb9..5f778696f0 100755
--- a/main/document/document.php
+++ b/main/document/document.php
@@ -1303,7 +1303,7 @@ if ($is_allowed_to_edit ||
                 $courseInfo,
                 api_get_user_id(),
                 $sessionId,
-                $groupIid,
+                $groupId,
                 $to_user_id,
                 $base_work_dir,
                 $dir_name,

From 36c646183146762d786739695dc55d0019f49d0f Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 14:16:22 +0200
Subject: [PATCH 7/9] Set api_get_group_id()

---
 main/upload/upload.document.php | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/main/upload/upload.document.php b/main/upload/upload.document.php
index c397696b2f..7569667ae3 100755
--- a/main/upload/upload.document.php
+++ b/main/upload/upload.document.php
@@ -56,7 +56,7 @@ if (isset($_FILES['user_upload'])) {
             $base_work_dir,
             $_POST['curdirpath'],
             api_get_user_id(),
-            $to_group_id,
+            api_get_group_id(),
             $to_user_id,
             $_POST['unzip'],
             $_POST['if_exists']
@@ -138,7 +138,7 @@ if (isset($_POST['create_dir']) && $_POST['dirname']!='') {
         $_course,
         api_get_user_id(),
         api_get_session_id(),
-        $to_group_id,
+        api_get_group_id(),
         $to_user_id,
         $base_work_dir,
         $dir_name,

From 24d31284f9b5f0dc24d5cf55f0fa310b722eeb7a Mon Sep 17 00:00:00 2001
From: jmontoyaa <gugli100@gmail.com>
Date: Thu, 29 Sep 2016 14:49:19 +0200
Subject: [PATCH 8/9] Fix fatal error see BT#11758

---
 main/work/work.lib.php | 9 ++++-----
 main/work/work.php     | 6 ++----
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/main/work/work.lib.php b/main/work/work.lib.php
index 0e1444a10c..0c0158086d 100755
--- a/main/work/work.lib.php
+++ b/main/work/work.lib.php
@@ -510,11 +510,11 @@ function showStudentWorkGrid()
     );
 
     $columnModel = array(
-        array('name'=>'type', 'index'=>'type', 'width'=>'30',   'align'=>'center', 'sortable' => 'false'),
+        array('name'=>'type', 'index'=>'type', 'width'=>'30', 'align'=>'center', 'sortable' => 'false'),
         array('name'=>'title', 'index'=>'title', 'width'=>'250',   'align'=>'left'),
         array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'80',  'align'=>'center', 'sortable'=>'false'),
-        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80',  'align'=>'center'),
-        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125',  'align'=>'center'),
+        array('name'=>'feedback', 'index'=>'feedback', 'width'=>'80',  'align'=>'center', 'sortable'=>'false'),
+        array('name'=>'last_upload', 'index'=>'feedback', 'width'=>'125',  'align'=>'center', 'sortable'=>'false')
     );
 
     if ($courseInfo['show_score'] == 0) {
@@ -554,7 +554,7 @@ function showTeacherWorkGrid()
         array('name'=>'title', 'index'=>'title',  'width'=>'300',   'align'=>'left', 'wrap_cell' => "true"),
         array('name'=>'sent_date', 'index'=>'sent_date', 'width'=>'125',  'align'=>'center'),
         array('name'=>'expires_on', 'index'=>'expires_on', 'width'=>'125',  'align'=>'center'),
-        array('name'=>'amount', 'index'=>'end_on', 'width'=>'110',  'align'=>'center'),
+        array('name'=>'amount', 'index'=>'amount', 'width'=>'110',  'align'=>'center', 'sortable' => 'false'),
         array('name'=>'actions', 'index'=>'actions', 'width'=>'110', 'align'=>'left', 'sortable'=>'false')
     );
 
@@ -1414,7 +1414,6 @@ function getWorkListStudent(
             $work['last_upload'] .= api_get_local_time($lastWork['sent_date']);
         }
 
-
         $work['title'] = Display::url($work['title'], $url.'&id='.$work['id']);
         $work['others'] = Display::url(
             Display::return_icon('group.png', get_lang('Others')),
diff --git a/main/work/work.php b/main/work/work.php
index e9094a22e6..4baef815d4 100755
--- a/main/work/work.php
+++ b/main/work/work.php
@@ -1,8 +1,6 @@
 <?php
 /* For licensing terms, see /license.txt */
 
-use ChamiloSession as Session;
-
 /**
  *	@package chamilo.work
  **/
@@ -333,9 +331,9 @@ switch ($action) {
                 get_lang('Description').':'.Security::remove_XSS($my_folder_data['description'], STUDENT).
                 '</div>';
         }
-        if (api_is_allowed_to_edit() || api_is_coach()) {
-            // Work list
 
+        // Work list
+        if (api_is_allowed_to_edit() || api_is_coach()) {
             $content .= '<div class="row">';
             $content .= '<div class="col-md-12">';
             $content .= '<div class="table-responsive">';

From 3558d6b29c87f6e7235a44a3237a98aa3fa2925a Mon Sep 17 00:00:00 2001
From: Yannick Warnier <ywarnier@beeznest.org>
Date: Thu, 29 Sep 2016 11:07:03 -0500
Subject: [PATCH 9/9] Fix division by zero in mySpace tracking - refs BT#11758

---
 main/mySpace/myStudents.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php
index f8359a56a0..75289413e8 100755
--- a/main/mySpace/myStudents.php
+++ b/main/mySpace/myStudents.php
@@ -733,7 +733,7 @@ if (!empty($student_id)) {
                         }
 
                         $scoretotal_display = '0/0 (0%)';
-                        if (!empty($scoretotal)) {
+                        if (!empty($scoretotal) && !empty($scoretotal[1])) {
                             $scoretotal_display =
                                 round($scoretotal[0], 1 ).'/'.
                                 round($scoretotal[1], 1).