Skip to content

Commit

Permalink
feat: Reorder flow to avoid concurrency failures
Browse files Browse the repository at this point in the history
  • Loading branch information
KminekMatej committed Sep 6, 2024
1 parent 08daa08 commit ff03b39
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/module/attendance/manager/AttendanceManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,9 @@ public function create(array $data, ?int $resourceId = null): Attendance
$this->responder->E4005_OBJECT_NOT_FOUND(Event::MODULE, $data["eventId"]);
}

$existingAttendance = $this->getByEventUserId($data["eventId"], $data["userId"]);

$this->allowCreate($data); //allowCreate checks right for both creating and updating already created attendance

$existingAttendance = $this->getByEventUserId($data["eventId"], $data["userId"]);
if (!$existingAttendance instanceof Attendance) {
$created = $this->createByArray($data);
if ($created && isset($data["preStatusId"])) {
Expand Down

0 comments on commit ff03b39

Please sign in to comment.