Skip to content

Commit c5a5158

Browse files
committed
chore: remove data updates on bulk event updates
1 parent e3365d2 commit c5a5158

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitEventsApiController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,7 +1398,7 @@ public function updateEvents($summit_id)
13981398
);
13991399
}
14001400

1401-
$this->service->updateEvents($summit, $data->all());
1401+
$this->service->updateEvents($summit, $data->all(), false);
14021402

14031403
return $this->updated();
14041404
});
@@ -1766,4 +1766,4 @@ public function getScheduledEventStreamingInfo($summit_id, $event_id)
17661766

17671767
});
17681768
}
1769-
}
1769+
}

app/Services/Model/ISummitService.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,10 @@ public function addEvent(Summit $summit, array $data);
5252
* @param Summit $summit
5353
* @param int $event_id
5454
* @param array $data
55+
* @param bool $trigger_data_update
5556
* @return SummitEvent
5657
*/
57-
public function updateEvent(Summit $summit, $event_id, array $data);
58+
public function updateEvent(Summit $summit, $event_id, array $data, bool $trigger_data_update = true);
5859

5960
/**
6061
* @param Summit $summit
@@ -147,7 +148,7 @@ public function deleteMyEventFeedback(Member $member, Summit $summit, int $event
147148
* @throws ValidationException
148149
*/
149150
public function deleteEventFeedback(Summit $summit, int $event_id, int $feedback_id):void;
150-
151+
151152
/**
152153
* @param Summit $summit
153154
* @param $external_order_id
@@ -221,11 +222,12 @@ public function updateAndPublishEvents(Summit $summit, array $data);
221222
/**
222223
* @param Summit $summit
223224
* @param array $data
225+
* @param bool $trigger_data_update
224226
* @throws ValidationException
225227
* @throws EntityNotFoundException
226228
* @return bool
227229
*/
228-
public function updateEvents(Summit $summit, array $data);
230+
public function updateEvents(Summit $summit, array $data, bool $trigger_data_update = true);
229231

230232
/**
231233
* @param array $data
@@ -680,4 +682,4 @@ public function getEventForStreamingInfo(Summit $summit, Member $current_user, i
680682
* @throws ValidationException
681683
*/
682684
public function validateBadge(Summit $summit, string $badge_qr_code): SummitAttendeeBadge;
683-
}
685+
}

app/Services/Model/Imp/SummitService.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -606,9 +606,9 @@ public function addEvent(Summit $summit, array $data)
606606
* @param array $data
607607
* @return SummitEvent
608608
*/
609-
public function updateEvent(Summit $summit, $event_id, array $data)
609+
public function updateEvent(Summit $summit, $event_id, array $data, bool $trigger_data_update = true)
610610
{
611-
return $this->saveOrUpdateEvent($summit, $data, $event_id);
611+
return $this->saveOrUpdateEvent($summit, $data, $event_id, $trigger_data_update);
612612
}
613613

614614
/**
@@ -645,21 +645,23 @@ private function canPerformEventTypeTransition(SummitEventType $old_event_type,
645645
* @param Summit $summit
646646
* @param array $data
647647
* @param null|int $event_id
648+
* @param bool $trigger_data_update
648649
* @return SummitEvent
649650
* @throws Exception
650651
*/
651-
private function saveOrUpdateEvent(Summit $summit, array $data, $event_id = null)
652+
private function saveOrUpdateEvent(Summit $summit, array $data, $event_id = null, bool $trigger_data_update = true)
652653
{
653-
return $this->tx_service->transaction(function () use ($summit, $data, $event_id) {
654+
return $this->tx_service->transaction(function () use ($summit, $data, $event_id, $trigger_data_update) {
654655

655656
Log::debug
656657
(
657658
sprintf
658659
(
659-
"SummitService::saveOrUpdateEvent summit %s event_id %s data %s",
660+
"SummitService::saveOrUpdateEvent summit %s event_id %s data %s trigger_data_update %b",
660661
$summit->getId(),
661662
$event_id ?? "NEW",
662-
json_encode($data)
663+
json_encode($data),
664+
$trigger_data_update
663665
)
664666
);
665667

@@ -841,6 +843,9 @@ private function saveOrUpdateEvent(Summit $summit, array $data, $event_id = null
841843

842844
$this->event_repository->add($event);
843845
$event->updateLastEdited();
846+
if(!$trigger_data_update){
847+
$event->skipDateUpdate();
848+
}
844849
return $event;
845850
});
846851
}
@@ -1473,18 +1478,20 @@ public function updateAndPublishEvents(Summit $summit, array $data)
14731478
/**
14741479
* @param Summit $summit
14751480
* @param array $data
1481+
* @param bool $trigger_data_update
14761482
* @return bool
14771483
* @throws EntityNotFoundException
14781484
* @throws ValidationException
14791485
*/
1480-
public function updateEvents(Summit $summit, array $data)
1486+
public function updateEvents(Summit $summit, array $data, bool $trigger_data_update = true)
14811487
{
14821488
return $this->tx_service->transaction(function () use (
14831489
$summit,
1484-
$data
1490+
$data,
1491+
$trigger_data_update
14851492
) {
14861493
foreach ($data['events'] as $event_data) {
1487-
$this->updateEvent($summit, intval($event_data['id']), $event_data);
1494+
$this->updateEvent($summit, intval($event_data['id']), $event_data, $trigger_data_update);
14881495
}
14891496

14901497
return true;
@@ -4172,4 +4179,4 @@ public function validateBadge(Summit $summit, string $badge_qr_code): SummitAtte
41724179

41734180
return $badge;
41744181
}
4175-
}
4182+
}

0 commit comments

Comments
 (0)