Minor - Flint fixes

pull/3495/head
Angel Fernando Quiroz Campos 5 years ago
parent bbb797315c
commit 239f2b9c8a
  1. 4
      main/gradebook/lib/be/exerciselink.class.php
  2. 66
      main/gradebook/lib/scoredisplay.class.php

@ -10,12 +10,12 @@
*/
class ExerciseLink extends AbstractLink
{
// This variable is used in the WSGetGradebookUserItemScore service, to check base course tests.
public $checkBaseExercises = false;
private $course_info;
private $exercise_table;
private $exercise_data = [];
private $is_hp;
// This variable is used in the WSGetGradebookUserItemScore service, to check base course tests.
public $checkBaseExercises = false;
/**
* @param int $hp

@ -340,6 +340,39 @@ class ScoreDisplay
return $display;
}
/**
* Depends on the teacher's configuration of thresholds. i.e. [0 50] "Bad", [50:100] "Good".
*
* @param array $score
*
* @return string
*/
public function display_custom($score)
{
if (empty($score)) {
return null;
}
$my_score_denom = $score[1] == 0 ? 1 : $score[1];
$scaledscore = $score[0] / $my_score_denom;
if ($this->upperlimit_included) {
foreach ($this->custom_display_conv as $displayitem) {
if ($scaledscore <= $displayitem['score']) {
return $displayitem['display'];
}
}
} else {
if (!empty($this->custom_display_conv)) {
foreach ($this->custom_display_conv as $displayitem) {
if ($scaledscore < $displayitem['score'] || $displayitem['score'] == 1) {
return $displayitem['display'];
}
}
}
}
}
/**
* Get current gradebook category id.
*
@ -488,39 +521,6 @@ class ScoreDisplay
return $score[0].' / '.$score[1];
}
/**
* Depends on the teacher's configuration of thresholds. i.e. [0 50] "Bad", [50:100] "Good".
*
* @param array $score
*
* @return string
*/
public function display_custom($score)
{
if (empty($score)) {
return null;
}
$my_score_denom = $score[1] == 0 ? 1 : $score[1];
$scaledscore = $score[0] / $my_score_denom;
if ($this->upperlimit_included) {
foreach ($this->custom_display_conv as $displayitem) {
if ($scaledscore <= $displayitem['score']) {
return $displayitem['display'];
}
}
} else {
if (!empty($this->custom_display_conv)) {
foreach ($this->custom_display_conv as $displayitem) {
if ($scaledscore < $displayitem['score'] || $displayitem['score'] == 1) {
return $displayitem['display'];
}
}
}
}
}
/**
* Get score color percent by category.
*

Loading…
Cancel
Save