take reversed polarity into account, normalize to 100%

This commit is contained in:
Helmut Merz 2015-04-21 13:42:48 +02:00
parent f935a0efb7
commit ae789e117b
3 changed files with 8 additions and 2 deletions

View file

@ -266,8 +266,11 @@ class SurveyView(InstitutionMixin, ConceptView):
values = [r.values.get(question) for r in self.teamData]
values = [v for v in values if v is not None]
if values:
average = round(float(sum(values)) / len(values), 2)
result['average'] = average
average = float(sum(values)) / len(values)
if question.revertAnswerOptions:
average = question.answerRange - average - 1
average = average * 100 / (question.answerRange - 1)
result['average'] = int(round(average))
texts = [r.texts.get(question) for r in self.teamData]
result['texts'] = '<br />'.join([unicode(t) for t in texts if t])
return result

Binary file not shown.

View file

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