Browse Source

Fixing warning message in gradebook

Julio Montoya 13 years ago
parent
commit
2ef3f57be7
1 changed files with 10 additions and 8 deletions
  1. 10 8
      main/gradebook/lib/fe/gradebooktable.class.php

+ 10 - 8
main/gradebook/lib/fe/gradebooktable.class.php

@@ -328,15 +328,17 @@ class GradebookTable extends SortableTable {
 			}
 		} //end looping categories
         
-        if (api_is_allowed_to_edit()) {            
-            $main_weight = intval($main_cat[0]->get_weight());    
-            if (intval($total_categories_weight) == $main_weight) {                
-                $total = Display::badge($total_categories_weight.' / '.$main_weight, 'success');
-            } else {                                                                       
-                $total = Display::badge($total_categories_weight.' / '.$main_weight, 'warning');                    
+        if (api_is_allowed_to_edit()) {           
+            if (count($main_cat) > 1) {
+                $main_weight = intval($main_cat[0]->get_weight());    
+                if (intval($total_categories_weight) == $main_weight) {                
+                    $total = Display::badge($total_categories_weight.' / '.$main_weight, 'success');
+                } else {                                                                       
+                    $total = Display::badge($total_categories_weight.' / '.$main_weight, 'warning');                    
+                }
+                $row = array(null, null, get_lang('Total'), null, $total);
+                $sortable_data[] = $row;
             }
-            $row = array(null, null, get_lang('Total'), null, $total);
-            $sortable_data[] = $row;
         }
 
 		// warning messages