Skip to content

Commit

Permalink
clean(ZMS-3253): pass corrected resolveReferences
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Fink authored and Thomas Fink committed Feb 17, 2025
1 parent a6e2d58 commit 27065a1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 11 deletions.
9 changes: 0 additions & 9 deletions zmsadmin/src/Zmsadmin/AvailabilityConflicts.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,18 +145,9 @@ private static function filterAndSortConflicts(ProcessList $conflictList)
foreach ($conflictList as $conflict) {
$availability1 = $conflict->getFirstAppointment()->getAvailability();
$availability2 = self::findMatchingAvailability($conflict, $conflictList);

// Use the availability's start date for weekday calculation
$availabilityDate = (new DateTimeImmutable())->setTimestamp($availability1->startDate);
$weekdayKey = strtolower($availabilityDate->format('l'));

error_log("Availability date: " . $availabilityDate->format('Y-m-d'));
error_log("Weekday key: " . $weekdayKey);
error_log("Availability1 weekdays: " . json_encode($availability1->weekday));
if ($availability2) {
error_log("Availability2 weekdays: " . json_encode($availability2->weekday));
}

if (self::doesConflictAffectWeekday($availability1, $availability2, $weekdayKey)) {
$filteredConflictList->addEntity($conflict);
self::addToConflictedList($conflictedList, $availability1, $availability2);
Expand Down
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/AvailabilityAdd.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ protected function writeEntityUpdate($entity, $resolveReferences): Entity
throw new AvailabilityAddFailed("Entity with ID {$entity->id} not found.");
}
} else {
$updatedEntity = $repository->writeEntity($entity, 2);
$updatedEntity = $repository->writeEntity($entity, resolveReferences: $resolveReferences);
}
if (!$updatedEntity) {
throw new AvailabilityAddFailed();
Expand Down
2 changes: 1 addition & 1 deletion zmsapi/src/Zmsapi/AvailabilityUpdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ protected function writeEntityUpdate($entity, $resolveReferences): Entity
throw new AvailabilityUpdateFailed("Entity with ID {$entity->id} not found.");
}
} else {
$updatedEntity = $repository->writeEntity($entity, 2);
$updatedEntity = $repository->writeEntity($entity, $resolveReferences);
}

if (!$updatedEntity) {
Expand Down

0 comments on commit 27065a1

Please sign in to comment.