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 = [r.values.get(question) for r in self.teamData]
values = [v for v in values if v is not None] values = [v for v in values if v is not None]
if values: if values:
average = round(float(sum(values)) / len(values), 2) average = float(sum(values)) / len(values)
result['average'] = average 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] texts = [r.texts.get(question) for r in self.teamData]
result['texts'] = '<br />'.join([unicode(t) for t in texts if t]) result['texts'] = '<br />'.join([unicode(t) for t in texts if t])
return result return result

Binary file not shown.

View file

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