Skip to content
Snippets Groups Projects
Commit 5cd75100 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

attemted to prevent event creationg in ConsultationSlot::updateEvents

parent cfb83c97
No related branches found
No related tags found
No related merge requests found
...@@ -88,7 +88,7 @@ class ConsultationBooking extends SimpleORMap implements PrivacyObject ...@@ -88,7 +88,7 @@ class ConsultationBooking extends SimpleORMap implements PrivacyObject
}; };
$config['registered_callbacks']['after_delete'][] = function (ConsultationBooking $booking) { $config['registered_callbacks']['after_delete'][] = function (ConsultationBooking $booking) {
$booking->slot->updateEvents(); $booking->slot->updateEvents(true);
}; };
parent::configure($config); parent::configure($config);
......
...@@ -190,8 +190,11 @@ class ConsultationSlot extends SimpleORMap ...@@ -190,8 +190,11 @@ class ConsultationSlot extends SimpleORMap
/** /**
* Updates the teacher event that belongs to the slot. This will either be * Updates the teacher event that belongs to the slot. This will either be
* set to be unoccupied, occupied by only one user or by a group of user. * set to be unoccupied, occupied by only one user or by a group of user.
*
* @param bool $delete_action Whether this method is called from a delete action (true)
* or not (false). Defaults to false.
*/ */
public function updateEvents() public function updateEvents(bool $delete_action = false)
{ {
// If no range is associated, remove the event // If no range is associated, remove the event
if (!$this->block->range) { if (!$this->block->range) {
...@@ -219,6 +222,9 @@ class ConsultationSlot extends SimpleORMap ...@@ -219,6 +222,9 @@ class ConsultationSlot extends SimpleORMap
} }
} }
if ($delete_action) {
return;
}
// Add events for missing responsible users // Add events for missing responsible users
$missing = array_diff($responsible_ids, $this->events->pluck('user_id')); $missing = array_diff($responsible_ids, $this->events->pluck('user_id'));
foreach ($missing as $user_id) { foreach ($missing as $user_id) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment