| … | |
… | |
| 690 | $row .= $answerMessage ? CGI::td($answerMessage) : ""; |
690 | $row .= $answerMessage ? CGI::td($answerMessage) : ""; |
| 691 | push @tableRows, $row; |
691 | push @tableRows, $row; |
| 692 | } |
692 | } |
| 693 | |
693 | |
| 694 | my $numIncorrectNoun = scalar @answerNames == 1 ? "question" : "questions"; |
694 | my $numIncorrectNoun = scalar @answerNames == 1 ? "question" : "questions"; |
| 695 | my $scorePercent = int ($problemResult->{score} * 100) . "\%"; |
695 | my $scorePercent = sprintf("%.0f%%", $problemResult->{score} * 100); |
| 696 | my $summary = "On this attempt, you answered $numCorrect out of " |
696 | my $summary = "On this attempt, you answered $numCorrect out of " |
| 697 | . scalar @answerNames . " $numIncorrectNoun correct, for a score of $scorePercent."; |
697 | . scalar @answerNames . " $numIncorrectNoun correct, for a score of $scorePercent."; |
| 698 | return CGI::table({-class=>"attemptResults"}, CGI::Tr(\@tableRows)) . ($showSummary ? CGI::p($summary) : ""); |
698 | return CGI::table({-class=>"attemptResults"}, CGI::Tr(\@tableRows)) . ($showSummary ? CGI::p($summary) : ""); |
| 699 | } |
699 | } |
| 700 | |
700 | |