Skip to content

Commit

Permalink
Setting assignment's isExam initial value based on group exam state.
Browse files Browse the repository at this point in the history
  • Loading branch information
krulis-martin committed May 24, 2024
1 parent 83f7f3a commit c76e372
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/V1Module/presenters/AssignmentsPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,11 @@ public function actionCreate()
$deadline = new DateTime();
$deadline->modify("+2 weeks")->modify('tomorrow')->modify("-1 minute");
$assignment = Assignment::assignToGroup($exercise, $group, false, $deadline);
if ($group->isExam() || ($group->hasExamPeriodSet() && $group->getExamBegin() <= (new DateTime()))) {
// assigned to exam group, or group with pending exam term
$assignment->setExam();
}

$this->assignments->persist($assignment);
$this->sendSuccessResponse($this->assignmentViewFactory->getAssignment($assignment));
}
Expand Down

0 comments on commit c76e372

Please sign in to comment.