allow question groups without feedback element

This commit is contained in:
Helmut Merz 2015-03-10 09:20:32 +01:00
parent 73839ea015
commit d05b9f7f70

View file

@ -107,9 +107,13 @@ class Response(object):
if scoreMax > 0.0: if scoreMax > 0.0:
relScore = score / scoreMax relScore = score / scoreMax
wScore = relScore * len(qugroup.feedbackItems) - 0.00001 wScore = relScore * len(qugroup.feedbackItems) - 0.00001
if qugroup.feedbackItems:
feedback = qugroup.feedbackItems[int(wScore)]
else:
feedback = u''
result.append(dict( result.append(dict(
group=qugroup, group=qugroup,
feedback=qugroup.feedbackItems[int(wScore)], feedback=feedback,
score=relScore)) score=relScore))
ranks = getRanks([r['score'] for r in result]) ranks = getRanks([r['score'] for r in result])
for idx, r in enumerate(result): for idx, r in enumerate(result):