Not display right answer when user gaveup the question in quiz

Re: Not display right answer when user gaveup the question in quiz

by Tim Hunt -
Number of replies: 2
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
You might also want to set $options->generalfeedback = 0; depending of what sort of general feedback your questions have.
Average of ratings: Useful (1)
In reply to Tim Hunt

Re: Not display right answer when user gaveup the question in quiz

by umer Ahmed -
Yes, thank you . A quick question. Where is the rightanswer that is displayed on the review page coming from? I have tried manipulating it at couple of different objects like $attemtObj and in quba and qustionattempt and few other places but the output does not change , the string is displayed as comma separated string (the way its stored in the database. Trying to replace ";" with dashes "-"
In reply to umer Ahmed

Re: Not display right answer when user gaveup the question in quiz

by umer Ahmed -
I found what I was looking for. The right answer are in an array . Under question/type/multichoice/render.php the correct_choices function implode the choices as long comma separated string. My requirement was to get a bullet list. so added the list tags in implode

/**
* Function returns string based on number of correct answers
* @param array $right An Array of correct responses to the current question
* @return string based on number of correct responses
*/
protected function correct_choices(array $right) {
// Return appropriate string for single/multiple correct answer(s).
if (count($right) == 1) {
return get_string('correctansweris', 'qtype_multichoice',
"".implode(' ', $right)."");
} else if (count($right) > 1) {
return get_string('correctanswersare', 'qtype_multichoice',
"".implode(' ', $right)."");
} else {
return "";
}
}