allow for presentation of questions without grouping by question groups

This commit is contained in:
Helmut Merz 2014-06-03 18:14:57 +02:00
parent 391bc395f0
commit 95a510c759
4 changed files with 46 additions and 7 deletions

View file

@ -44,6 +44,7 @@ class SurveyView(ConceptView):
data = None
errors = None
minBatchSize = 10
@Lazy
def macro(self):
@ -55,6 +56,26 @@ class SurveyView(ConceptView):
if self.editable:
return 'index.html'
@Lazy
def groups(self):
result = []
if self.adapted.noGrouping:
questions = list(self.adapted.questions)
questions.sort(key=lambda x: x.title)
size = len(questions)
nb = size / self.minBatchSize
rem = size % self.minBatchSize
bs = self.minBatchSize + ((rem + self.minBatchSize) / nb)
for idx in range(0, size, bs):
result.append(dict(title=u'Question', infoText=None,
questions=questions[idx:idx+bs]))
else:
for group in self.adapted.questionGroups:
result.append(dict(title=group.title,
infoText=self.getInfoText(group),
questions=group.questions))
return result
@Lazy
def answerOptions(self):
opts = self.adapted.answerOptions

View file

@ -61,11 +61,14 @@
</div>
<form method="post">
<table class="listing">
<tal:qugroup repeat="qugroup item/adapted/questionGroups">
<tr><td colspan="6">&nbsp;</td></tr>
<tal:group repeat="group item/groups">
<tr>
<td>&nbsp;</td>
<td tal:repeat="opt item/answerOptions">&nbsp;</td></tr>
<tr class="vpad">
<td tal:define="infoText python:item.getInfoText(qugroup)">
<b tal:content="qugroup/title" />
<td tal:define="infoText group/infoText">
<b i18n:translate=""
tal:content="group/title" />
<div class="infotext"
tal:condition="infoText">
<span tal:content="structure infoText" />
@ -77,7 +80,7 @@
tal:content="opt/label" />
</tr>
<tr class="vpad"
tal:repeat="question qugroup/questions">
tal:repeat="question group/questions">
<td tal:content="question/text" />
<td style="white-space: nowrap; text-align: center"
tal:repeat="value python:item.getValues(question)">
@ -90,7 +93,7 @@
title value/title" />
</td>
</tr>
</tal:qugroup>
</tal:group>
</table>
<input type="submit" name="submit" value="Evaluate Questionnaire"
i18n:attributes="value" />

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: 0.13.0\n"
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
"PO-Revision-Date: 2014-05-25 12:00 CET\n"
"PO-Revision-Date: 2014-06-03 12:00 CET\n"
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
"Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n"
@ -178,6 +178,18 @@ msgstr "Glossareintrag anlegen."
msgid "Answer Range"
msgstr "Abstufung Bewertungen"
msgid "Answer Options"
msgstr "Antwortmöglichkeiten"
msgid "Values to select from with corresponding column labels and descriptions. There should be at least answer range items with numeric values."
msgstr "Auszuwählende Werte mit zugehörigen Spaltenüberschriften und Beschreibungen. Es sollte mindestens so viele Einträge mit numerischen Werten geben wie durch das Feld 'Abstufung Bewertungen' vorgegeben."
msgid "No Grouping of Questions"
msgstr "Keine Gruppierung der Fragen"
msgid "The questions should be presented in a linear manner, not grouped by categories or question groups."
msgstr "Die Fragen sollen in linearer Reihenfolge ausgegeben und nicht nach Fragengruppen bzw. Kategorien gruppiert werden."
msgid "Feedback Footer"
msgstr "Auswertungs-Hinweis"
@ -205,6 +217,9 @@ msgstr "Negative Polarität"
msgid "Value inversion: High selection means low value."
msgstr "Invertierung der Bewertung: Hohe gewählte Stufe bedeutet niedriger Wert."
msgid "Question"
msgstr "Frage"
msgid "Questionnaire"
msgstr "Fragebogen"