Skip to content

Commit

Permalink
Fixed results view
Browse files Browse the repository at this point in the history
  • Loading branch information
daniele-andreotti committed Jan 25, 2017
1 parent ba84227 commit ecc2922
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
</th>
</tr>
</thead>

<tr tal:repeat="matrix_question matrix_questions"
tal:attributes="class python:repeat['matrix_question'].odd() and 'odd' or 'even'">
<div tal:omit-tag=""
Expand Down Expand Up @@ -83,7 +83,7 @@
<select tal:condition="python: question.getInputType() == 'multipleSelect' and hasOptions"
tal:define="answer python:request.get(str(qid) + '-' + str(mqid), None) or matrix_question.getAnswerFor(member_id);"
multiple="multiple"
tal:attributes="name string:${qid}-${mqid};
tal:attributes="name string:${qid}-${mqid};
id string:${qid}-${mqid};">
<option tal:repeat="option question/getQuestionOptions"
class="noborder"
Expand All @@ -103,7 +103,7 @@
tal:attributes="value option;
name string:${qid}-${mqid};
id string:${qid}-${mqid};
checked python: answer and option in answer;"/>
checked python: answer and str(option) in answer;"/>
</td>
</div>
</tr>
Expand Down
14 changes: 12 additions & 2 deletions Products/PloneSurvey/content/BaseQuestion.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,22 @@ def getAnswerFor(self, userid):
if self.getInputType() in ['multipleSelect', 'checkbox']:
if type(answer) == 'NoneType':
return []
if isinstance(answer, int):
return [str(answer)]

if self.getInputType() in ['radio', 'selectionBox']:
if not answer:
return ""
return []
if isinstance(answer, unicode):
answer = answer.encode('utf8')
return str(answer)
return [str(answer)]

if self.getInputType() in ['area']:
if not answer:
return ''
if isinstance(answer, unicode):
answer = answer.encode('utf8')

return answer

security.declareProtected(permissions.View, 'getCommentsFor')
Expand Down

0 comments on commit ecc2922

Please sign in to comment.