MDL-20296 modifications necessary for improving grading for numerical and transform display.html as independent from

shortanswer, add display of unitpenalty for numerical in print_question_grading_details()
This commit is contained in:
Pierre Pichet
2010-05-21 01:37:42 +00:00
parent e14042cdf3
commit a65fa92a9f
+6 -3
View File
@@ -316,7 +316,6 @@ class question_shortanswer_qtype extends default_questiontype {
$grade->cur = question_format_grade($cmoptions, $state->last_graded->grade);
$grade->max = question_format_grade($cmoptions, $question->maxgrade);
$grade->raw = question_format_grade($cmoptions, $state->last_graded->raw_grade);
// let student know wether the answer was correct
$class = question_get_feedback_class($state->last_graded->raw_grade /
$question->maxgrade);
@@ -330,7 +329,7 @@ class question_shortanswer_qtype extends default_questiontype {
echo '<div class="gradingdetails">';
// print grade for this submission
print_string('gradingdetails', 'quiz', $grade);
print_string('gradingdetails', 'quiz', $grade) ;
if ($cmoptions->penaltyscheme) {
// print details of grade adjustment due to penalties
if ($state->last_graded->raw_grade > $state->last_graded->grade){
@@ -341,8 +340,12 @@ class question_shortanswer_qtype extends default_questiontype {
// penalty is relevant only if the answer is not correct and further attempts are possible
if (($state->last_graded->raw_grade < $question->maxgrade) and (QUESTION_EVENTCLOSEANDGRADE != $state->event)) {
if ('' !== $state->last_graded->penalty && ((float)$state->last_graded->penalty) > 0.0) {
// A penalty was applied so display it
// A unit penalty for numerical was applied so display it
if(isset($question->raw_unitpenalty) && $question->raw_unitpenalty > 0.0 ){
echo ' ';
print_string('unitappliedpenalty','qtype_numerical',question_format_grade($cmoptions, $this->raw_unitpenalty));
}
echo ' '.$this->raw_unitpenalty ;
print_string('gradingdetailspenalty', 'quiz', question_format_grade($cmoptions, $state->last_graded->penalty));
} else {
/* No penalty was applied even though the answer was