Fixed bug with rendering level 0 demo badges
Added rounding of points
This commit is contained in:
parent
2a5de0af0e
commit
c2cb225fa6
|
@ -53,8 +53,9 @@ class block_gradelevel extends block_base {
|
|||
}
|
||||
else {
|
||||
// below can be a single call to $this->levelset->get_user_leveldata() once the need for debugging (fixed point total) is gone
|
||||
$pointstotal = $this->levelset->get_levelset_grade($USER->id);
|
||||
$pointstotal = round($this->levelset->get_levelset_grade($USER->id),1);
|
||||
$level_info = $this->levelset->calculate_level($pointstotal);
|
||||
|
||||
|
||||
$this->content->text = $this->levelset->render_badge($pointstotal);
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ class block_gradelevel_levelset {
|
|||
public function render_demo_badge(int $size=100, $level=null)
|
||||
{
|
||||
$levels = $this->badgelevels();
|
||||
if($level == null || $level > count($levels))
|
||||
if($level === null || $level > count($levels))
|
||||
{
|
||||
$points = array_pop(array_keys($levels));
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?php
|
||||
$plugin->component = 'block_gradelevel'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494)
|
||||
$plugin->version = 2019091300; // YYYYMMDDHH (year, month, day, iteration)
|
||||
$plugin->version = 2019100900; // YYYYMMDDHH (year, month, day, iteration)
|
||||
$plugin->requires = 2018050800; // YYYYMMDDHH (This is the release version for Moodle 3.5)
|
|
@ -51,7 +51,7 @@ if(count($course_groups > 0))
|
|||
print "<ul class='skill_results'>";
|
||||
foreach($members as $usr)
|
||||
{
|
||||
$pointstotal = $skill->get_levelset_grade($usr->id);
|
||||
$pointstotal = round($skill->get_levelset_grade($usr->id),1);
|
||||
$level_info = $skill->calculate_level($pointstotal);
|
||||
|
||||
print "<li class='result_badge'>";
|
||||
|
@ -84,7 +84,7 @@ usort( $remaining_users, function( $a, $b) {
|
|||
print "<ul class='skill_results other'>";
|
||||
foreach($remaining_users as $usr)
|
||||
{
|
||||
$pointstotal = $skill->get_levelset_grade($usr->id);
|
||||
$pointstotal = round($skill->get_levelset_grade($usr->id),1);
|
||||
$level_info = $skill->calculate_level($pointstotal);
|
||||
print "<li class='result_badge'>";
|
||||
print $skill->render_badge($pointstotal,BADGE_SIZE);
|
||||
|
|
Loading…
Reference in New Issue
Block a user