Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def add_relatedexaminers(self, *users):
relatedexaminers = []
for user in users:
if isinstance(user, RelatedExaminer):
relatedexaminer = user
else:
relatedexaminer = RelatedExaminer(
user=user)
relatedexaminer.period = self.period
relatedexaminers.append(relatedexaminer)
RelatedExaminer.objects.bulk_create(relatedexaminers)
return self
def add_relatedexaminers(self, *users):
relatedexaminers = []
for user in users:
if isinstance(user, RelatedExaminer):
relatedexaminer = user
else:
relatedexaminer = RelatedExaminer(
user=user)
relatedexaminer.period = self.period
relatedexaminers.append(relatedexaminer)
RelatedExaminer.objects.bulk_create(relatedexaminers)
return self
def add_relatedexaminers(self, *users):
relatedexaminers = []
for user in users:
if isinstance(user, RelatedExaminer):
relatedexaminer = user
else:
relatedexaminer = RelatedExaminer(
user=user)
relatedexaminer.period = self.period
relatedexaminers.append(relatedexaminer)
RelatedExaminer.objects.bulk_create(relatedexaminers)
return self
def add_relatedexaminers(self, *users):
relatedexaminers = []
for user in users:
if isinstance(user, RelatedExaminer):
relatedexaminer = user
else:
relatedexaminer = RelatedExaminer(
user=user)
relatedexaminer.period = self.period
relatedexaminers.append(relatedexaminer)
RelatedExaminer.objects.bulk_create(relatedexaminers)
return self
def get_relatedexaminer(self, relatedexaminer_id):
try:
return coremodels.RelatedExaminer.objects.get(id=relatedexaminer_id)
except coremodels.RelatedExaminer.DoesNotExist:
raise NotFound({'error': 'Examiner does not exist.'})
first_deadline=assignment_publishing_time + timezone.timedelta(days=7),
points_to_grade_mapper=coremodels.Assignment.POINTS_TO_GRADE_MAPPER_RAW_POINTS,
max_points=50,
parentnode=period
)
assignment.save()
relatedexaminers = []
for num in range(10):
examiner_user = get_user_model()(
fullname='Examiner#{}'.format(num),
shortname='examiner#{}@example.com'.format(num)
)
examiner_user.save()
print(('Create examineruser#{}'.format(num)))
relatedexaminer = coremodels.RelatedExaminer(
user=examiner_user,
period=period
)
relatedexaminer.save()
relatedexaminers.append(relatedexaminer.id)
grading_published_datetime = assignment_publishing_time + timezone.timedelta(days=8)
assignment_groups = []
# Create assignment groups and add students
for num in range(num_students):
assignment_group = coremodels.AssignmentGroup(
parentnode=assignment
)
assignment_group.save()
print(('Create assignment group#{}'.format(num)))
def get_model_class(self):
return RelatedExaminer
def __get_relatedexaminer_ids(self):
return RelatedExaminer.objects\
.select_related('user')\
.filter(period_id=self.assignment.parentnode_id) \
.filter(examiner__assignmentgroup__parentnode_id=self.assignment.id)\
.only('id')\
.distinct('id')\
.values_list('id', flat=True)
def __get_relatedexaminer(self):
try:
return self.get_relatedexaminer_queryset().get(id=self.get_relatedexaminer_id())
except RelatedExaminer.DoesNotExist:
raise Http404()
# and a new assingment in the current period
student = UserBuilder('psylocke', full_name='Elisabeth Braddock').user
examiner = UserBuilder('magneto', full_name='Erik Lehnsherr').user
examiner2 = UserBuilder('beast', full_name='Hank McCoy').user
first_deadline = timezone.now() - timezone.timedelta(weeks=2, days=1)
periodbuilder = self.duckburgh.add_subject(
short_name='inf7020',
long_name='INF7020 Programming for World Domination and Crashing Non-Mutant Economy',
).add_6month_active_period(
short_name='testsemester',
long_name='Testsemester',
relatedexaminers=[
RelatedExaminer(user=examiner),
RelatedExaminer(user=examiner2),
],
relatedstudents=[student])
assignmentgroupbuilder = periodbuilder.add_assignment(
'Oblig 1 - Domination',
passing_grade_min_points=3,
max_points=10,
first_deadline=first_deadline
).add_group()
assignmentgroupbuilder.add_candidates_from_relatedstudents(
*periodbuilder.period.relatedstudent_set.all())
assignmentgroupbuilder.add_examiners(examiner, examiner2)
feedbacksetbuilder1 = assignmentgroupbuilder.add_feedback_set(
points=1,
published_by=examiner,