Details
-
Improvement
-
Status: Resolved
-
Minor
-
Resolution: Done
-
3.3.7
-
None
-
3.3.3 (Build - 2018013100)
-
MOODLE_33_STABLE
-
MOODLE_35_STABLE
Description
Given a Radio Button question with the following possible answers:
Cat
!other
!other=Something that squeeks
!other=Something that bites
... & a number of responses selecting each !other option, when exporting the data it's impossible to see which !other option was actually selected
The following patch resolves this (against 92d950c):
git diff |
diff --git a/questionnaire.class.php b/questionnaire.class.php
|
index 7daab5b..215b4d2 100644
|
--- a/questionnaire.class.php
|
+++ b/questionnaire.class.php
|
@@ -3218,7 +3218,7 @@ class questionnaire {
|
$content = $choicesbyqid[$qid][$responserow->choice_id]->content;
|
if (preg_match('/^!other/', $content)) {
|
// If this has an "other" text, use it.
|
- $responsetxt = get_string('other', 'questionnaire');
|
+ $responsetxt = preg_replace(["/^!other=/", "/^!other/"], ['', get_string('other', 'questionnaire')], $content);
|
$responsetxt1 = $responserow->response;
|
} else if (($choicecodes == 1) && ($choicetext == 1)) {
|
$responsetxt = $c.' : '.$content;
|
This leads to the correct data in the exported file, instead of the generic "Other:" language string as currently used:
Q01_ANIMAL | Q01_ANIMAL_Other |
---|---|
Something that bites | Crocodile |
Something that squeeks | Big bird |
Other: | Ewok |