This commit is contained in:
Ross
2021-12-31 10:45:09 +00:00
parent 6efe4dc74b
commit 3a4d9cbb5a
8 changed files with 130 additions and 0 deletions
+14
View File
@@ -115,6 +115,8 @@ class ExamBase(models.Model):
stats_graph = models.TextField(default=0)
user_scores = models.JSONField(default=dict)
notes = GenericRelation("generic.CidUserExam")
# time_limit = models.IntegerField(
@@ -125,6 +127,15 @@ class ExamBase(models.Model):
class Meta:
abstract = True
def get_exam_stats(self):
text = f"""{self.name}
-----
Candidate number: {self.stats_candidates}
Max (possible) score: {self.stats_max_possible}
Mean: {self.stats_mean} Median: {self.stats_median} Mode: {self.stats_mode} [Min: {self.stats_min} / Max: {self.stats_max}]
"""
return text
def __str__(self):
return self.name
@@ -303,6 +314,9 @@ class CidUser(models.Model):
if self.results_email_sent and not resend:
return False, "Already sent."
# Get a list of taken exams
exams = self.get_cid_exams()
msg = f"""
"""