Skip to content

Commit

Permalink
Fixed some loss in information caused by boolean coersion
Browse files Browse the repository at this point in the history
References #102
  • Loading branch information
u8sand committed Dec 11, 2018
1 parent 725def0 commit 0892021
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions FAIRshakeAPI/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def get_answer_forms(self, assessment):
'%s-%s' % (answer.metric.id, key): getattr(answer, key)
for answer in assessment.answers.all()
for key in ['answer', 'comment', 'url_comment']
if getattr(answer, key)
if getattr(answer, key, None) is not None
},
self.request.GET,
)
Expand All @@ -368,7 +368,7 @@ def get_answer_forms(self, assessment):
for answer in assessment.answers.all():
for key, attr in auto_assessment_results.get('metric:%d' % (answer.metric.id), {}).items():
k = '%s-%s' % (answer.metric.id, key)
if attr and not initial.get(k):
if attr is not None and initial.get(k) is not None:
initial[k] = attr

return [
Expand Down

0 comments on commit 0892021

Please sign in to comment.