This commit is contained in:
Ross
2021-02-16 12:45:19 +00:00
parent 1e8697e6bb
commit a0b9e92aba
4 changed files with 47 additions and 60 deletions
+23 -16
View File
@@ -618,33 +618,40 @@ def loadJsonAnswer(answer):
)
posted_answer = answer["ans"]
# Normal answers are just posted with the answer "Normal"
normal = False
if posted_answer == "Normal":
normal = True
posted_answer = ""
# We can ignore the first ab
elif answer["qidn"] == "1" and posted_answer == "Abnormal":
return False
# Long cases seperate sections by qidn
qidn = answer["qidn"]
# If the user answer does not exist
if not exiting_answers:
ans = CidUserAnswer(answer=posted_answer, normal=normal, cid=answer["cid"])
ans = CidUserAnswer(cid=answer["cid"])
ans.question_id = answer["qid"]
ans.exam_id = eid
ans.full_clean()
ans.save()
# If the answer already exists or we have started populating it
else:
# Update an existing answer
# should never be more than one (famous last words)
ans = exiting_answers[0]
ans.normal = normal
ans.answer = posted_answer
ans.full_clean()
ans.save()
if qidn == "1":
ans.answer_observations = posted_answer
elif qidn == "2":
ans.answer_interpretation = posted_answer
elif qidn == "3":
ans.answer_principle_diagnosis = posted_answer
elif qidn == "4":
ans.answer_differential_diagnosis = posted_answer
elif qidn == "5":
ans.answer_management = posted_answer
# Mark as unmarked
ans.score = ans.ScoreOptions.UNMARKED
ans.full_clean()
ans.save()
return True