provide column for standard deviation on single question report - but keep inactive at the moment

This commit is contained in:
Helmut Merz 2015-04-21 20:27:30 +02:00
parent ae789e117b
commit 38d74bcb21
4 changed files with 13 additions and 0 deletions

View file

@ -23,6 +23,7 @@ surveys and self-assessments.
import csv
from cStringIO import StringIO
import math
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.cachedescriptors.property import Lazy
from zope.i18n import translate
@ -269,8 +270,12 @@ class SurveyView(InstitutionMixin, ConceptView):
average = float(sum(values)) / len(values)
if question.revertAnswerOptions:
average = question.answerRange - average - 1
devs = [(average - v) for v in values]
stddev = math.sqrt(sum(d * d for d in devs) / len(values))
average = average * 100 / (question.answerRange - 1)
stddev = stddev * 100 / (question.answerRange - 1)
result['average'] = int(round(average))
result['stddev'] = int(round(stddev))
texts = [r.texts.get(question) for r in self.teamData]
result['texts'] = '<br />'.join([unicode(t) for t in texts if t])
return result

View file

@ -178,10 +178,12 @@
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<!--<td>&nbsp;</td>-->
</tr>
<tr class="vpad">
<td><b tal:content="group/title" /></td>
<td i18n:translate="">Average</td>
<!--<td i18n:translate="">Deviation</td>-->
</tr>
<tr tal:repeat="question group/questions">
<tal:question
@ -197,6 +199,9 @@
<td class="center">
<span tal:condition="python:qutype == 'value_selection'"
tal:content="data/average" /></td>
<!--<td class="center">
<span tal:condition="python:qutype == 'value_selection'"
tal:content="data/stddev" /></td>-->
</tal:question>
</tr>
</tal:group>

Binary file not shown.

View file

@ -342,6 +342,9 @@ msgstr "Rang Team"
msgid "Average"
msgstr "Durchschnitt"
msgid "Deviation"
msgstr "Abweichung"
msgid "Team Size"
msgstr "Anzahl der vom Team ausgefüllten Fragebögen"