refactor result data structure, fix rank calculation, add team rank
This commit is contained in:
parent
11f3218ea4
commit
6ff8e8211a
4 changed files with 30 additions and 28 deletions
|
@ -76,7 +76,8 @@ class SurveyView(ConceptView):
|
|||
if data:
|
||||
resp = Response(self.adapted, None)
|
||||
for qu in self.adapted.questions:
|
||||
resp.values[qu] = data[qu.uid]
|
||||
if qu.uid in data:
|
||||
resp.values[qu] = data[qu.uid]
|
||||
qgAvailable = True
|
||||
for qg in self.adapted.questionGroups:
|
||||
if qg.uid in data:
|
||||
|
@ -85,8 +86,8 @@ class SurveyView(ConceptView):
|
|||
qgAvailable = False
|
||||
if not qgAvailable:
|
||||
values = resp.getGroupedResult()
|
||||
for qugroup, info, score in values:
|
||||
resp.values[qugroup] = score
|
||||
for v in values:
|
||||
resp.values[v['group']] = v['score']
|
||||
result.append(resp)
|
||||
return result
|
||||
|
||||
|
@ -106,22 +107,22 @@ class SurveyView(ConceptView):
|
|||
data[uid] = value
|
||||
response.values[question] = value
|
||||
values = response.getGroupedResult()
|
||||
for qugroup, info, score in values:
|
||||
data[self.getUidForObject(qugroup)] = score
|
||||
for v in values:
|
||||
data[self.getUidForObject(v['group'])] = v['score']
|
||||
respManager.save(data)
|
||||
self.data = data
|
||||
self.errors = self.check(response)
|
||||
if self.errors:
|
||||
return []
|
||||
result = [dict(category=r[0].title, text=r[1].text,
|
||||
score=int(round(r[2] * 100)))
|
||||
for r in values]
|
||||
result = [dict(category=r['group'].title, text=r['feedback'].text,
|
||||
score=int(round(r['score'] * 100)), rank=r['rank'])
|
||||
for r in values]
|
||||
if self.adapted.showTeamResults:
|
||||
teamData = self.getTeamData(respManager)
|
||||
ranks, averages = response.getTeamResult(values, teamData)
|
||||
for idx, qgdata in enumerate(result):
|
||||
qgdata['rank'] = ranks[idx]
|
||||
qgdata['average'] = int(round(averages[idx] * 100))
|
||||
values = response.getTeamResult(values, teamData)
|
||||
for idx, r in enumerate(values):
|
||||
result[idx]['average'] = int(round(r['average'] * 100))
|
||||
result[idx]['teamRank'] = r['rank']
|
||||
return result
|
||||
|
||||
def check(self, response):
|
||||
|
|
|
@ -13,21 +13,21 @@
|
|||
<h3 i18n:translate="">Feedback</h3>
|
||||
<div tal:define="header item/adapted/feedbackHeader"
|
||||
tal:condition="header"
|
||||
tal:content="structure python:item.renderText(header, 'text/restructured')" />
|
||||
tal:content="structure python:
|
||||
item.renderText(header, 'text/restructured')" />
|
||||
<table class="listing">
|
||||
<tr>
|
||||
<th i18n:translate="">Category</th>
|
||||
<th tal:condition="item/showFeedbackText"
|
||||
i18n:translate="">Response</th>
|
||||
<th class="center"
|
||||
i18n:translate="">Score %</th>
|
||||
i18n:translate="">Score</th>
|
||||
<th class="center"
|
||||
i18n:translate="">Rank</th>
|
||||
<tal:team condition="item/adapted/showTeamResults">
|
||||
<th class="center"
|
||||
i18n:translate="">Rank</th>
|
||||
i18n:translate="">Team Score</th>
|
||||
<th class="center"
|
||||
i18n:translate="">Team Score %</th>
|
||||
<th class="center"
|
||||
tal:condition="nothing"
|
||||
i18n:translate="">Team Rank</th>
|
||||
</tal:team>
|
||||
</tr>
|
||||
|
@ -37,12 +37,13 @@
|
|||
tal:content="fbitem/text" />
|
||||
<td class="center"
|
||||
tal:content="fbitem/score" />
|
||||
<td class="center"
|
||||
tal:content="fbitem/rank" />
|
||||
<tal:team condition="item/adapted/showTeamResults">
|
||||
<td class="center"
|
||||
tal:content="fbitem/rank" />
|
||||
<td class="center"
|
||||
tal:content="fbitem/average" />
|
||||
<td tal:condition="nothing" />
|
||||
<td class="center"
|
||||
tal:content="fbitem/teamRank" />
|
||||
</tal:team>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
Binary file not shown.
|
@ -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: 2014-05-07 12:00 CET\n"
|
||||
"PO-Revision-Date: 2014-05-24 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"
|
||||
|
@ -265,17 +265,17 @@ msgstr "Bitte beantworten Sie die angegebene Mindestanzahl an Fragen je Fragengr
|
|||
msgid "Obligatory question, must be answered"
|
||||
msgstr "Pflichtfrage, muss beantwortet werden"
|
||||
|
||||
msgid "Score %"
|
||||
msgstr "Bewertung %"
|
||||
msgid "Score"
|
||||
msgstr "Bewertung"
|
||||
|
||||
msgid "Team Score %"
|
||||
msgstr "Durchschnitt Team %"
|
||||
msgid "Team Score"
|
||||
msgstr "Durchschnitt Team"
|
||||
|
||||
msgid "Rank"
|
||||
msgstr "Rang im Team"
|
||||
msgstr "Rang"
|
||||
|
||||
msgid "Team Rank"
|
||||
msgstr "Rang des Teams"
|
||||
msgstr "Rang Team"
|
||||
|
||||
# competence (qualification)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue