highlight missing questions; show team size
This commit is contained in:
parent
95a510c759
commit
ed996977f9
4 changed files with 47 additions and 21 deletions
|
@ -45,6 +45,7 @@ class SurveyView(ConceptView):
|
||||||
data = None
|
data = None
|
||||||
errors = None
|
errors = None
|
||||||
minBatchSize = 10
|
minBatchSize = 10
|
||||||
|
teamData = None
|
||||||
|
|
||||||
@Lazy
|
@Lazy
|
||||||
def macro(self):
|
def macro(self):
|
||||||
|
@ -170,8 +171,8 @@ class SurveyView(ConceptView):
|
||||||
score=int(round(r['score'] * 100)), rank=r['rank'])
|
score=int(round(r['score'] * 100)), rank=r['rank'])
|
||||||
for r in values]
|
for r in values]
|
||||||
if self.showTeamResults:
|
if self.showTeamResults:
|
||||||
teamData = self.getTeamData(respManager)
|
self.teamData = self.getTeamData(respManager)
|
||||||
teamValues = response.getTeamResult(values, teamData)
|
teamValues = response.getTeamResult(values, self.teamData)
|
||||||
for idx, r in enumerate(teamValues):
|
for idx, r in enumerate(teamValues):
|
||||||
result[idx]['average'] = int(round(r['average'] * 100))
|
result[idx]['average'] = int(round(r['average'] * 100))
|
||||||
result[idx]['teamRank'] = r['rank']
|
result[idx]['teamRank'] = r['rank']
|
||||||
|
@ -182,7 +183,8 @@ class SurveyView(ConceptView):
|
||||||
values = response.values
|
values = response.values
|
||||||
for qu in self.adapted.questions:
|
for qu in self.adapted.questions:
|
||||||
if qu.required and qu not in values:
|
if qu.required and qu not in values:
|
||||||
errors.append('Please answer the obligatory questions.')
|
errors.append(dict(uid=qu.uid,
|
||||||
|
text='Please answer the obligatory questions.'))
|
||||||
break
|
break
|
||||||
qugroups = {}
|
qugroups = {}
|
||||||
for qugroup in self.adapted.questionGroups:
|
for qugroup in self.adapted.questionGroups:
|
||||||
|
@ -194,7 +196,12 @@ class SurveyView(ConceptView):
|
||||||
if minAnswers in (u'', None):
|
if minAnswers in (u'', None):
|
||||||
minAnswers = len(qugroup.questions)
|
minAnswers = len(qugroup.questions)
|
||||||
if count < minAnswers:
|
if count < minAnswers:
|
||||||
errors.append('Please answer the minimum number of questions.')
|
if self.adapted.noGrouping:
|
||||||
|
errors.append(dict(uid=qugroup.uid,
|
||||||
|
text='Please answer the highlighted questions.'))
|
||||||
|
else:
|
||||||
|
errors.append(dict(uid=qugroup.uid,
|
||||||
|
text='Please answer the minimum number of questions.'))
|
||||||
break
|
break
|
||||||
return errors
|
return errors
|
||||||
|
|
||||||
|
@ -229,6 +236,12 @@ class SurveyView(ConceptView):
|
||||||
title=opt['description']))
|
title=opt['description']))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def getCssClass(self, question):
|
||||||
|
cls = ''
|
||||||
|
if self.errors and self.data.get(question.uid) is None:
|
||||||
|
cls = 'error '
|
||||||
|
return cls + 'vpad'
|
||||||
|
|
||||||
|
|
||||||
class SurveyCsvExport(NodeView):
|
class SurveyCsvExport(NodeView):
|
||||||
|
|
||||||
|
|
|
@ -37,9 +37,15 @@
|
||||||
</tal:cols>
|
</tal:cols>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
<p tal:define="teamData item/teamData"
|
||||||
|
tal:condition="teamData">
|
||||||
|
<b><span i18n:translate="">Team Size</span>:
|
||||||
|
<span tal:content="python:len(teamData)" /></b><br />
|
||||||
|
</p>
|
||||||
<div class="button" id="show_questionnaire">
|
<div class="button" id="show_questionnaire">
|
||||||
<a href="" onclick="back(); return false"
|
<a href="" xxonclick="back(); return false"
|
||||||
i18n:translate="">
|
i18n:translate=""
|
||||||
|
tal:attributes="href view/virtualTargetUrl">
|
||||||
Back to Questionnaire</a>
|
Back to Questionnaire</a>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
@ -56,7 +62,7 @@
|
||||||
tal:condition="errors">
|
tal:condition="errors">
|
||||||
<div tal:repeat="error errors">
|
<div tal:repeat="error errors">
|
||||||
<span i18n:translate=""
|
<span i18n:translate=""
|
||||||
tal:content="error" />
|
tal:content="error/text" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form method="post">
|
<form method="post">
|
||||||
|
@ -79,20 +85,21 @@
|
||||||
i18n:translate=""
|
i18n:translate=""
|
||||||
tal:content="opt/label" />
|
tal:content="opt/label" />
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="vpad"
|
<tal:question repeat="question group/questions">
|
||||||
tal:repeat="question group/questions">
|
<tr tal:attributes="class python:item.getCssClass(question)">
|
||||||
<td tal:content="question/text" />
|
<td tal:content="question/text" />
|
||||||
<td style="white-space: nowrap; text-align: center"
|
<td style="white-space: nowrap; text-align: center"
|
||||||
tal:repeat="value python:item.getValues(question)">
|
tal:repeat="value python:item.getValues(question)">
|
||||||
<input type="radio"
|
<input type="radio"
|
||||||
i18n:attributes="title"
|
i18n:attributes="title"
|
||||||
tal:attributes="
|
tal:attributes="
|
||||||
name string:question_${question/uid};
|
name string:question_${question/uid};
|
||||||
value value/value;
|
value value/value;
|
||||||
checked value/checked;
|
checked value/checked;
|
||||||
title value/title" />
|
title value/title" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
</tal:question>
|
||||||
</tal:group>
|
</tal:group>
|
||||||
</table>
|
</table>
|
||||||
<input type="submit" name="submit" value="Evaluate Questionnaire"
|
<input type="submit" name="submit" value="Evaluate Questionnaire"
|
||||||
|
|
Binary file not shown.
|
@ -277,6 +277,9 @@ msgstr "Bitte beantworten Sie die Pflichtfragen."
|
||||||
msgid "Please answer the minimum number of questions."
|
msgid "Please answer the minimum number of questions."
|
||||||
msgstr "Bitte beantworten Sie die angegebene Mindestanzahl an Fragen je Fragengruppe."
|
msgstr "Bitte beantworten Sie die angegebene Mindestanzahl an Fragen je Fragengruppe."
|
||||||
|
|
||||||
|
msgid "Please answer the highlighted questions."
|
||||||
|
msgstr "Bitte beantworten Sie die markierten Fragen."
|
||||||
|
|
||||||
msgid "Obligatory question, must be answered"
|
msgid "Obligatory question, must be answered"
|
||||||
msgstr "Pflichtfrage, muss beantwortet werden"
|
msgstr "Pflichtfrage, muss beantwortet werden"
|
||||||
|
|
||||||
|
@ -292,6 +295,9 @@ msgstr "Rang"
|
||||||
msgid "Team Rank"
|
msgid "Team Rank"
|
||||||
msgstr "Rang Team"
|
msgstr "Rang Team"
|
||||||
|
|
||||||
|
msgid "Team Size"
|
||||||
|
msgstr "Anzahl der vom Team ausgefüllten Fragebögen"
|
||||||
|
|
||||||
# competence (qualification)
|
# competence (qualification)
|
||||||
|
|
||||||
msgid "Validity Period (Months)"
|
msgid "Validity Period (Months)"
|
||||||
|
|
Loading…
Add table
Reference in a new issue