mirror of
https://github.com/moodle/moodle.git
synced 2025-03-06 08:49:53 +01:00
MDL-16610 "Warnings when a question has a grade of 0" not seeing this issue in HEAD but committing some code to make code for generating html for response cell more robust.
This commit is contained in:
parent
1c88737ffa
commit
8968f51fab
@ -152,20 +152,18 @@ class quiz_report_responses_table extends table_sql {
|
|||||||
$question = $this->questions[$questionid];
|
$question = $this->questions[$questionid];
|
||||||
restore_question_state($question, $stateforqinattempt);
|
restore_question_state($question, $stateforqinattempt);
|
||||||
|
|
||||||
$responses = get_question_actual_response($question, $stateforqinattempt);
|
if ($responses = get_question_actual_response($question, $stateforqinattempt)){
|
||||||
$response = (!empty($responses)? implode('; ',$responses) : '-');
|
$response = (!empty($responses)? implode('; ',$responses) : '-');
|
||||||
$grade = $stateforqinattempt->grade
|
} else {
|
||||||
/ $this->questions[$questionid]->maxgrade;
|
$response = '';
|
||||||
|
}
|
||||||
if (!$this->is_downloading()) {
|
if (!$this->is_downloading()) {
|
||||||
|
if ($response){
|
||||||
$format_options = new stdClass;
|
$format_options = new stdClass;
|
||||||
$format_options->para = false;
|
$format_options->para = false;
|
||||||
$format_options->noclean = true;
|
$format_options->noclean = true;
|
||||||
$format_options->newlines = false;
|
$format_options->newlines = false;
|
||||||
$qclass = question_get_feedback_class($grade);
|
|
||||||
$feedbackimg = question_get_feedback_image($grade);
|
|
||||||
$questionclass = "que";
|
|
||||||
$response = format_text($response, FORMAT_MOODLE, $format_options);
|
$response = format_text($response, FORMAT_MOODLE, $format_options);
|
||||||
if ($response){
|
|
||||||
if (strlen($response) > QUIZ_REPORT_RESPONSES_MAX_LEN_TO_DISPLAY){
|
if (strlen($response) > QUIZ_REPORT_RESPONSES_MAX_LEN_TO_DISPLAY){
|
||||||
$response = shorten_text($response, QUIZ_REPORT_RESPONSES_MAX_LEN_TO_DISPLAY);
|
$response = shorten_text($response, QUIZ_REPORT_RESPONSES_MAX_LEN_TO_DISPLAY);
|
||||||
}
|
}
|
||||||
@ -173,7 +171,13 @@ class quiz_report_responses_table extends table_sql {
|
|||||||
$attempt->attempt . '&question=' . $question->id,
|
$attempt->attempt . '&question=' . $question->id,
|
||||||
'reviewquestion', $response, 450, 650, get_string('reviewresponse', 'quiz'),
|
'reviewquestion', $response, 450, 650, get_string('reviewresponse', 'quiz'),
|
||||||
'none', true);
|
'none', true);
|
||||||
if (question_state_is_graded($stateforqinattempt)){
|
if (question_state_is_graded($stateforqinattempt)
|
||||||
|
&& ($this->questions[$questionid]->maxgrade != 0)){
|
||||||
|
$grade = $stateforqinattempt->grade
|
||||||
|
/ $this->questions[$questionid]->maxgrade;
|
||||||
|
$qclass = question_get_feedback_class($grade);
|
||||||
|
$feedbackimg = question_get_feedback_image($grade);
|
||||||
|
$questionclass = "que";
|
||||||
return "<span class=\"$questionclass\"><span class=\"$qclass\">".$response."</span></span>$feedbackimg";
|
return "<span class=\"$questionclass\"><span class=\"$qclass\">".$response."</span></span>$feedbackimg";
|
||||||
} else {
|
} else {
|
||||||
return $response;
|
return $response;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user