fix: ensure unique services mapping when creating api payload
This commit is contained in:
@@ -461,10 +461,12 @@ class BookingEditDraftService
|
||||
private function resolveServiceArray(array $serviceIds, array $services): array
|
||||
{
|
||||
$resolved = [];
|
||||
$addedIds = [];
|
||||
|
||||
foreach ($serviceIds as $serviceId) {
|
||||
if (isset($services[$serviceId])) {
|
||||
if (isset($services[$serviceId]) && false === isset($addedIds[$serviceId])) {
|
||||
$resolved[] = $services[$serviceId];
|
||||
$addedIds[$serviceId] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -126,6 +126,7 @@ class BookingFingerprintService
|
||||
private function normalizeServiceArray(array $services): array
|
||||
{
|
||||
$ids = array_map(fn ($s) => $s->id, $services);
|
||||
$ids = array_unique($ids);
|
||||
sort($ids);
|
||||
|
||||
return array_values($ids);
|
||||
|
||||
Reference in New Issue
Block a user