quiz and qtypes: Regressions from MDL-7308 since '0.0000000' is not empty() in PHP.

This commit is contained in:
tjhunt 2009-03-11 06:36:25 +00:00
parent f3a076ded4
commit 26da840f6b
3 changed files with 8 additions and 9 deletions

View File

@ -168,7 +168,7 @@ class quiz_report_responses_table extends table_sql {
'reviewquestion', $summary, 450, 650, get_string('reviewresponse', 'quiz'),
'none', true);
if (question_state_is_graded($stateforqinattempt)
&& ($question->maxgrade != 0)){
&& ($question->maxgrade > 0)){
$grade = $stateforqinattempt->grade
/ $question->maxgrade;
$qclass = question_get_feedback_class($grade);
@ -193,9 +193,9 @@ class quiz_report_responses_table extends table_sql {
function col_feedbacktext($attempt){
if ($attempt->timefinish) {
if (!$this->is_downloading()) {
return quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz), $this->quiz->id);
return quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz, false), $this->quiz->id);
} else {
return strip_tags(quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz), $this->quiz->id));
return strip_tags(quiz_report_feedback_for_grade(quiz_rescale_grade($attempt->sumgrades, $this->quiz, false), $this->quiz->id));
}
} else {
return '-';

View File

@ -777,10 +777,9 @@ class default_questiontype {
// ULPGC ecastro
function get_fractional_grade(&$question, &$state) {
$maxgrade = $question->maxgrade;
$grade = $state->grade;
if ($maxgrade) {
return (float)($grade/$maxgrade);
if ($question->maxgrade > 0) {
return (float)($grade / $question->maxgrade);
} else {
return (float)$grade;
}
@ -908,7 +907,7 @@ class default_questiontype {
}
$grade = '';
if ($question->maxgrade and $options->scores) {
if ($question->maxgrade > 0 && $options->scores) {
if ($cmoptions->optionflags & QUESTION_ADAPTIVE) {
if ($isgraded) {
$grade = question_format_grade($cmoptions, $state->last_graded->grade).'/';
@ -1148,7 +1147,7 @@ class default_questiontype {
echo ' ';
print_string('duplicateresponse', 'quiz');
}
if (!empty($question->maxgrade) && $options->scores) {
if ($question->maxgrade > 0 && $options->scores) {
if (question_state_is_graded($state->last_graded)) {
// Display the grading details from the last graded state
$grade = new stdClass;

View File

@ -309,7 +309,7 @@ class question_shortanswer_qtype extends default_questiontype {
echo ' ';
print_string('duplicateresponse', 'quiz');
}
if (!empty($question->maxgrade) && $options->scores) {
if ($question->maxgrade > 0 && $options->scores) {
if (question_state_is_graded($state->last_graded)) {
// Display the grading details from the last graded state
$grade = new stdClass;