Browse Source

Add new score format "exercise_score_format" see BT#15958

Julio Montoya 5 years ago
parent
commit
de0f6024e1
2 changed files with 13 additions and 0 deletions
  1. 7 0
      main/inc/lib/exercise.lib.php
  2. 6 0
      main/install/configuration.dist.php

+ 7 - 0
main/inc/lib/exercise.lib.php

@@ -2885,6 +2885,13 @@ HOTSPOT;
             $html = $scoreBasedInModel;
         }
 
+        // Ignore other formats and use the configuratio['exercise_score_format'] value
+        // But also keep the round values settings.
+        $format = api_get_configuration_value('exercise_score_format');
+        if (!empty($format)) {
+            $html = ScoreDisplay::instance()->display_score([ $score, $weight]);
+        }
+
         $html = Display::span($html, ['class' => 'score_exercise']);
 
         return $html;

+ 6 - 0
main/install/configuration.dist.php

@@ -1280,6 +1280,12 @@ requires extension "php-soap"  sudo apt-get install php-soap
 // Allow user to enter a LP item if it was validated in another session.
 // $_configuration['validate_lp_prerequisite_from_other_session'] = false;
 
+// 1 = SCORE_AVERAGE (5 / 10)
+// 2 = SCORE_PERCENT (50%)
+// 3 = SCORE_DIV_PERCENT (5 / 10 (50%))
+// 5 = SCORE_DECIMAL (0.5 (50%))
+// $_configuration['exercise_score_format'] = 0;
+
 // KEEP THIS AT THE END
 // -------- Custom DB changes
 // Add user activation by confirmation email