rearrange answer options; allow for unanswered questions; intermediate question group headings

This commit is contained in:
Helmut Merz 2013-03-18 10:54:08 +01:00
parent ac144b99a3
commit 74988c1834
5 changed files with 86 additions and 42 deletions

View file

@ -52,9 +52,10 @@ class SurveyView(ConceptView):
if key.startswith('question_'):
uid = key[len('question_'):]
question = adapted(self.getObjectForUid(uid))
value = int(value)
self.data[uid] = value
response.values[question] = value
if value != 'none':
value = int(value)
self.data[uid] = value
response.values[question] = value
# TODO: store self.data in track
# else:
# get response from track
@ -65,9 +66,10 @@ class SurveyView(ConceptView):
for r in result]
def getValues(self, question):
setting = 0
setting = None
if self.data is not None:
setting = self.data.get(question.uid) or 0
return [dict(value=i, checked=(i == setting))
for i in range(question.answerRange)]
setting = self.data.get(question.uid)
noAnswer = [dict(value='none', checked=(setting == None))]
return noAnswer + [dict(value=i, checked=(setting == i))
for i in reversed(range(question.answerRange))]

View file

@ -43,11 +43,24 @@ class IQuestionGroup(IConceptSchema, interfaces.IQuestionGroup):
""" A group of questions within a questionnaire.
"""
minAnswers = schema.Int(
title=_(u'Minimum Number of Answers'),
description=_(u'Minumum number of questions that have to be answered. '
'Empty means all questions have to be answered.'),
default=4,
required=False)
class IQuestion(IConceptSchema, interfaces.IQuestion):
""" A single question within a questionnaire.
"""
required = schema.Bool(
title=_(u'Required'),
description=_(u'Question must be answered.'),
default=False,
required=False)
revertAnswerOptions = schema.Bool(
title=_(u'Negative'),
description=_(u'Value inversion: High selection means low value.'),

View file

@ -7,7 +7,7 @@
<metal:title use-macro="item/conceptMacros/concepttitle" />
<div tal:condition="feedback">
<h3 i18n:translate="">Feedback</h3>
<table>
<table class="listing">
<tr>
<th i18n:translate="">Category</th>
<th i18n:translate="">Response</th>
@ -23,33 +23,32 @@
</div>
<h3 i18n:translate="">Questionnaire</h3>
<form method="post">
<table>
<tr>
<th></th>
<th>
<table>
<tr>
<td i18n:translate="">Does not apply</td>
<td style="text-align: right"
i18n:translate="">Fully applies</td>
</tr>
</table>
</th>
</tr>
<tr tal:repeat="question item/adapted/questions">
<td tal:content="question/text" />
<td style="white-space: nowrap">
<span tal:repeat="value python:item.getValues(question)">&nbsp;
<input type="radio"
i18n:attributes="title"
tal:attributes="
name string:question_${question/uid};
value value/value;
checked value/checked;
title string:survey_value_${value/value}" />&nbsp;
</span>
</td>
</tr>
<table class="listing">
<tal:qugroup repeat="qugroup item/adapted/questionGroups">
<tr>
<td><b tal:content="qugroup/title" /></td>
<td style="text-align: center"
i18n:translate="">No answer</td>
<td colspan="2"
i18n:translate="">Fully applies</td>
<td colspan="2"
style="text-align: right"
i18n:translate="">Does not apply</td>
</tr>
<tr tal:repeat="question qugroup/questions">
<td tal:content="question/text" />
<td style="white-space: nowrap; text-align: center"
tal:repeat="value python:item.getValues(question)">
<input type="radio"
i18n:attributes="title"
tal:attributes="
name string:question_${question/uid};
value value/value;
checked value/checked;
title string:survey_value_${value/value}" />&nbsp;
</td>
</tr>
</tal:qugroup>
</table>
<br />
<input type="submit" name="submit" value="Evaluate Questionnaire"

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: 2013-03-07 12:00 CET\n"
"PO-Revision-Date: 2013-03-18 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,8 +178,20 @@ msgstr "Abstufung Bewertungen"
msgid "Number of items (answer options) to select from."
msgstr "Anzahl der Abstufungen, aus denen bei der Antwort gewählt werden kann."
msgid "Negativ"
msgstr "Negativbewertung"
msgid "Minimum Number of Answers"
msgstr "Mindestanzahl an Antworten"
msgid "Minumum number of questions that have to be answered. Empty means all questions have to be answered."
msgstr "Anzahl der Fragen, die mindestens beantwortet werden müssen. Keine Angabe: Es müssen alle Fragen beantwortet werden."
msgid "Required"
msgstr "Erforderlich"
msgid "Question must be answered."
msgstr "Frage muss unbedingt beantwortet werden."
msgid "Negative"
msgstr "Negative Polarität"
msgid "Value inversion: High selection means low value."
msgstr "Invertierung der Bewertung: Hohe gewählte Stufe bedeutet niedriger Wert."
@ -196,27 +208,45 @@ msgstr "Kategorie"
msgid "Response"
msgstr "Beurteilung"
msgid "No answer"
msgstr "Keine Antwort"
msgid "Does not apply"
msgstr "Trifft nicht zu"
msgid "Fully applies"
msgstr "Trifft voll zu"
msgid "survey_value_none"
msgstr "Keine Antwort"
msgid "survey_value_0"
msgstr "trifft für unser Unternehmen überhaupt nicht zu"
msgstr "Trifft für unser Unternehmen überhaupt nicht zu"
msgid "survey_value_1"
msgstr "trifft eher nicht zu"
msgstr "Trifft eher nicht zu"
msgid "survey_value_2"
msgstr "trifft eher zu"
msgstr "Trifft eher zu"
msgid "survey_value_3"
msgstr "trifft für unser Unternehmen voll und ganz zu"
msgstr "Trifft für unser Unternehmen voll und ganz zu"
msgid "Evaluate Questionnaire"
msgstr "Fragebogen auswerten"
msgid "Please answer at least $minAnswers questions."
msgstr "Bitte beantworten Sie mindestens $minAnswers Fragen."
msgid "Please answer all questions."
msgstr "Bitte beantworten Sie alle Fragen."
msgid "Please answer the obligatory questions marked with an asterisk."
msgstr "Bitte beantworten Sie die mit einem Stern markierten Pflichtfragen."
msgid "Obligatory question, must be answered"
msgstr "Pflichtfrage, muss beantwortet werden"
# competence (qualification)
msgid "Validity Period (Months)"