update sba testing (and fix others)
This commit is contained in:
+16
-12
@@ -31,8 +31,8 @@ from generic.models import (
|
||||
ExamUserStatus,
|
||||
QuestionBase,
|
||||
Site,
|
||||
#Condition,
|
||||
#Sign,
|
||||
# Condition,
|
||||
# Sign,
|
||||
ExamBase,
|
||||
QuestionNote,
|
||||
UserAnswerBase,
|
||||
@@ -308,7 +308,7 @@ class Rapid(QuestionBase):
|
||||
exams = ", ".join(e)
|
||||
return exams
|
||||
|
||||
def get_unmarked_user_answer_string(self, exam_pk: int=None):
|
||||
def get_unmarked_user_answer_string(self, exam_pk: int = None):
|
||||
unmarked_answers = self.get_unmarked_user_answers(exam_pk)
|
||||
|
||||
if not unmarked_answers:
|
||||
@@ -319,7 +319,7 @@ class Rapid(QuestionBase):
|
||||
)
|
||||
)
|
||||
|
||||
def get_unmarked_user_answers(self, exam_pk: int|None=None, marker=None):
|
||||
def get_unmarked_user_answers(self, exam_pk: int | None = None, marker=None):
|
||||
# If normal no answers to mark (they will be automarked)
|
||||
if self.normal:
|
||||
return []
|
||||
@@ -470,20 +470,25 @@ class Rapid(QuestionBase):
|
||||
return new_answers
|
||||
|
||||
def get_question_json(
|
||||
self, based: bool = True, feedback: bool = False, answers: bool = True, history: bool = False, annotations: bool = False
|
||||
self,
|
||||
based: bool = True,
|
||||
feedback: bool = False,
|
||||
answers: bool = True,
|
||||
history: bool = False,
|
||||
annotations: bool = False,
|
||||
) -> QuestionData:
|
||||
"""Returns a json representation of the question"""
|
||||
|
||||
# Loop through rapidimage associations
|
||||
images = []
|
||||
annotations = []
|
||||
annotations_list = []
|
||||
feedback_images = []
|
||||
for i in self.images.all():
|
||||
# TODO: add anotations
|
||||
|
||||
if i.feedback_image == True:
|
||||
if feedback:
|
||||
annotations.append(i.image_annotations)
|
||||
annotations_list.append(i.image_annotations)
|
||||
if based:
|
||||
feedback_images.append(image_as_base64(i.image))
|
||||
else:
|
||||
@@ -492,7 +497,7 @@ class Rapid(QuestionBase):
|
||||
)
|
||||
# feedback_images.append("{}/{}".format(settings.REMOTE_URL, i.image.url))
|
||||
else:
|
||||
annotations.append(i.image_annotations)
|
||||
annotations_list.append(i.image_annotations)
|
||||
if based:
|
||||
images.append(image_as_base64(i.image))
|
||||
else:
|
||||
@@ -504,8 +509,8 @@ class Rapid(QuestionBase):
|
||||
"type": "rapid",
|
||||
}
|
||||
|
||||
if annotations:
|
||||
json["annotations"] = annotations
|
||||
if annotations:
|
||||
json["annotations"] = annotations_list
|
||||
|
||||
if history:
|
||||
json["history"] = self.history
|
||||
@@ -736,6 +741,7 @@ class Exam(ExamBase):
|
||||
@reversion.register
|
||||
class UserAnswer(UserAnswerBase):
|
||||
"""User answers by candidate"""
|
||||
|
||||
app_name = "rapids"
|
||||
|
||||
question = models.ForeignKey(
|
||||
@@ -748,7 +754,6 @@ class UserAnswer(UserAnswerBase):
|
||||
|
||||
answer_compare = models.TextField(max_length=500, blank=True)
|
||||
|
||||
|
||||
user = models.ForeignKey(
|
||||
settings.AUTH_USER_MODEL,
|
||||
on_delete=models.CASCADE,
|
||||
@@ -781,7 +786,6 @@ class UserAnswer(UserAnswerBase):
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
|
||||
name = self.get_candidate_name()
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user