Skip to content

Commit

Permalink
MDL-34774 Lesson module: fixed report stats for 'high score' and 'low…
Browse files Browse the repository at this point in the history
… score' values where there is only one attempt with 0 score
  • Loading branch information
Rossiani Wijaya committed Feb 28, 2013
1 parent a09484c commit 819cdd8
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions mod/lesson/report.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@
$numofattempts++;
$avescore += $try["grade"];
$avetime += $timetotake;
if ($try["grade"] > $highscore || $highscore == NULL) {
if ($try["grade"] > $highscore || $highscore === NULL) {
$highscore = $try["grade"];
}
if ($try["grade"] < $lowscore || $lowscore == NULL) {
if ($try["grade"] < $lowscore || $lowscore === NULL) {
$lowscore = $try["grade"];
}
if ($timetotake > $hightime || $hightime == NULL) {
Expand Down Expand Up @@ -346,10 +346,10 @@
} else {
$lowtime = format_time($lowtime);
}
if ($highscore == NULL) {
if ($highscore === NULL) {
$highscore = get_string("notcompleted", "lesson");
}
if ($lowscore == NULL) {
if ($lowscore === NULL) {
$lowscore = get_string("notcompleted", "lesson");
}

Expand All @@ -362,7 +362,14 @@
$stattable->align = array('center', 'center', 'center', 'center', 'center', 'center');
$stattable->wrap = array('nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap', 'nowrap');
$stattable->attributes['class'] = 'standardtable generaltable';
$stattable->data[] = array($avescore.'%', $avetime, $highscore.'%', $lowscore.'%', $hightime, $lowtime);

if (is_numeric($highscore)) {
$highscore .= '%';
}
if (is_numeric($lowscore)) {
$lowscore .= '%';
}
$stattable->data[] = array($avescore.'%', $avetime, $highscore, $lowscore, $hightime, $lowtime);

echo html_writer::table($stattable);
} else if ($action === 'reportdetail') {
Expand Down

0 comments on commit 819cdd8

Please sign in to comment.