update get_or_create_cid_user_exam
This commit is contained in:
+9
-2
@@ -92,7 +92,7 @@ class Examination(models.Model):
|
||||
def __str__(self):
|
||||
return self.examination
|
||||
|
||||
def merge_into(self, examination_to_merge_into: Self, delete: bool=True) -> bool:
|
||||
def merge_into(self, examination_to_merge_into: Self, delete: bool = True) -> bool:
|
||||
"""Merges the current examination into another
|
||||
|
||||
To do so it replaces all associations (many to many and foreign key relations)
|
||||
@@ -452,10 +452,17 @@ class ExamCollectionGenericBase(models.Model):
|
||||
return False
|
||||
|
||||
def get_or_create_cid_user_exam(
|
||||
self, cid_user=None, user_user=None, start_time=None
|
||||
self,
|
||||
cid: int | None = None,
|
||||
cid_user: "CidUser | None" = None,
|
||||
user_user: User | None = None,
|
||||
start_time=None,
|
||||
):
|
||||
content_type = ContentType.objects.get_for_model(self)
|
||||
|
||||
if cid is not None:
|
||||
cid_user = CidUser.objects.filter(cid=cid).first()
|
||||
|
||||
if cid_user is not None:
|
||||
c = CidUserExam.objects.filter(
|
||||
content_type=content_type, object_id=self.pk, cid_user=cid_user
|
||||
|
||||
Reference in New Issue
Block a user