Browse Source

Minor corrections

Julio Montoya 14 years ago
parent
commit
5217902f2b
2 changed files with 7 additions and 3 deletions
  1. 6 2
      main/exercice/exercise.lib.php
  2. 1 1
      main/session/index.php

+ 6 - 2
main/exercice/exercise.lib.php

@@ -1142,6 +1142,9 @@ function get_exam_results_data($from, $number_of_items, $column, $direction) {
  * @return  string  an html with the score modified
  */
 function show_score($score, $weight, $show_percentage = true, $use_platform_settings = true) {
+    if (is_null($score) && is_null($weight)) {
+        return '-';
+    }
     $html  = '';
     $score_rounded = $score;     
     $max_note =  api_get_setting('exercise_max_score');
@@ -1159,8 +1162,9 @@ function show_score($score, $weight, $show_percentage = true, $use_platform_sett
     }    
     $score_rounded = float_format($score, 1);    
     $weight = float_format($weight, 1);    
-    if ($show_percentage) {
-        $html = float_format(($score / ($weight != 0 ? $weight : 1)) * 100, 1) . '% (' . $score_rounded . ' / ' . $weight . ')';	
+    if ($show_percentage) {        
+        $parent = '(' . $score_rounded . ' / ' . $weight . ')';
+        $html = float_format(($score / ($weight != 0 ? $weight : 1)) * 100, 1) . "%  $parent";	
     } else {    
     	$html = $score_rounded . ' / ' . $weight;
     }    

+ 1 - 1
main/session/index.php

@@ -238,7 +238,7 @@ $column_exercise_model  = array(
                                 array('name'=>'attempt',    'index'=>'attempt',   'width'=>'60', 'align'=>'center', 'sortable'=>'true'),
                                 array('name'=>'result',     'index'=>'result',    'width'=>'140', 'align'=>'center', 'sortable'=>'true'),
                                 array('name'=>'best_result','index'=>'best_result','width'=>'140','align'=>'center', 'sortable'=>'true'),
-                                array('name'=>'position',   'index'=>'position',  'width'=>'50', 'align'=>'center', 'sortable'=>'true')
+                                array('name'=>'position',   'index'=>'position',  'width'=>'60', 'align'=>'center', 'sortable'=>'true')
                                 );                        
 //$extra_params_exercise['grouping'] = 'true';
 //$extra_params_exercise['groupingView'] = array('groupField'=>array('course'),'groupColumnShow'=>'false','groupText' => array('<b>'.get_lang('Course').' {0}</b>'));