Survey [[question variable]] now returns the shown answer text for multiple choice questions, and the recorded value for non-multiple choice questions.
This commit is contained in:
parent
2b2e876b6d
commit
8cd5588f10
3 changed files with 10 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
7.7.4
|
7.7.4
|
||||||
- Default Survey Question bundles now store full answer information in json. Everything configured in an answer will be saved in a default configuration.
|
- Default Survey Question bundles now store full answer information in json. Everything configured in an answer will be saved in a default configuration.
|
||||||
|
- Survey [[question variable]] now returns the shown answer text for multiple choice questions, and the recorded value for non-multiple choice questions.
|
||||||
|
|
||||||
7.7.3
|
7.7.3
|
||||||
- fixed #10094: double explanation in thread help
|
- fixed #10094: double explanation in thread help
|
||||||
|
|
|
||||||
|
|
@ -738,12 +738,18 @@ sub responseValuesByVariableName {
|
||||||
|
|
||||||
# Grab the corresponding question
|
# Grab the corresponding question
|
||||||
my $question = $self->survey->question([@address]);
|
my $question = $self->survey->question([@address]);
|
||||||
|
|
||||||
# Filter out questions without defined variable names
|
# Filter out questions without defined variable names
|
||||||
next if !$question || !defined $question->{variable};
|
next if !$question || !defined $question->{variable};
|
||||||
|
|
||||||
|
#Test if question is a multiple choice type so we can use the answer text instead
|
||||||
|
my $answerText;
|
||||||
|
if($self->survey->getMultiChoiceBundle($question->{questionType})){
|
||||||
|
$answerText = $self->survey->answer([@address])->{text};
|
||||||
|
}
|
||||||
|
|
||||||
# Add variable => value to our hash
|
# Add variable => value to our hash
|
||||||
$lookup{$question->{variable}} = $response->{value};
|
$lookup{$question->{variable}} = $answerText ? $answerText : $response->{value};
|
||||||
}
|
}
|
||||||
return \%lookup;
|
return \%lookup;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -998,9 +998,7 @@ sub updateQuestionAnswers {
|
||||||
|
|
||||||
=head2 getMultiChoiceBundle
|
=head2 getMultiChoiceBundle
|
||||||
|
|
||||||
Returns a list of answers for each multi-choice bundle.
|
Returns a list of answer objects for each multi-choice bundle.
|
||||||
|
|
||||||
Currently these are hard-coded but soon they will live in the database.
|
|
||||||
|
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue