Skip to content
Snippets Groups Projects
Commit 2bfd5b48 authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Resolve "Fragebogen: Single Choice CSV-Export unnötig kompliziert"

Closes #4308

Merge request studip/studip!3110
parent 26b26107
No related branches found
No related tags found
No related merge requests found
......@@ -98,7 +98,9 @@ class Vote extends QuestionnaireQuestion implements QuestionType
$output = [];
$options = $this['questiondata']['options'] ? $this['questiondata']['options']->getArrayCopy() : [];
$multiplechoice = (bool) $this['questiondata']['multiplechoice'];
if ($multiplechoice) {
foreach ($options as $key => $option) {
$answerOption = [];
$countNobodys = 0;
......@@ -121,6 +123,25 @@ class Vote extends QuestionnaireQuestion implements QuestionType
}
$output[$option] = $answerOption;
}
} else {
$answerOption = [];
$countNobodys = 0;
foreach ($this->answers as $answer) {
$answerData = $answer['answerdata']->getArrayCopy();
if ($answer['user_id'] && $answer['user_id'] !== 'nobody') {
$userId = $answer['user_id'];
} else {
$userId = _('unbekannt') . ' ' . ++$countNobodys;
}
$answerOption[$userId] = $options[$answerData['answers']];
}
$question = strip_tags($this['questiondata']['description']);
$output[$question] = $answerOption;
}
return $output;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment