| … | |
… | |
| 501 | |
501 | |
| 502 | print CGI::start_div({class=>"scoreSummary"}); |
502 | print CGI::start_div({class=>"scoreSummary"}); |
| 503 | # score summary |
503 | # score summary |
| 504 | my $attempts = $problem->num_correct + $problem->num_incorrect; |
504 | my $attempts = $problem->num_correct + $problem->num_incorrect; |
| 505 | my $attemptsNoun = $attempts != 1 ? "times" : "time"; |
505 | my $attemptsNoun = $attempts != 1 ? "times" : "time"; |
| 506 | my $lastScore = int ($problem->status * 100) . "%"; |
506 | my $lastScore = sprintf("%.0f%%", $problem->status * 100); # Round to whole number |
| 507 | my ($attemptsLeft, $attemptsLeftNoun); |
507 | my ($attemptsLeft, $attemptsLeftNoun); |
| 508 | if ($problem->max_attempts == -1) { |
508 | if ($problem->max_attempts == -1) { |
| 509 | # unlimited attempts |
509 | # unlimited attempts |
| 510 | $attemptsLeft = "unlimited"; |
510 | $attemptsLeft = "unlimited"; |
| 511 | $attemptsLeftNoun = "attempts"; |
511 | $attemptsLeftNoun = "attempts"; |