Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Stud.IP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robin Schmöcker
Stud.IP
Commits
5cd75100
Commit
5cd75100
authored
3 years ago
by
Moritz Strohm
Browse files
Options
Downloads
Patches
Plain Diff
attemted to prevent event creationg in ConsultationSlot::updateEvents
parent
cfb83c97
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/models/ConsultationBooking.php
+1
-1
1 addition, 1 deletion
lib/models/ConsultationBooking.php
lib/models/ConsultationSlot.php
+7
-1
7 additions, 1 deletion
lib/models/ConsultationSlot.php
with
8 additions
and
2 deletions
lib/models/ConsultationBooking.php
+
1
−
1
View file @
5cd75100
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
lib/models/ConsultationSlot.php
+
7
−
1
View file @
5cd75100
...
@@ -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
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment