fix: multiple attendances per capability - #815
Open
crosspolar wants to merge 5 commits into
Open
Conversation
Collaborator
|
Is this ready for review? |
Theophile-Madet
requested changes
Jul 27, 2026
Theophile-Madet
left a comment
Collaborator
There was a problem hiding this comment.
I think the logic is good, I left a few nitpicking comments.
| user, shift, slots, last_staffing_status=None, staffing_status=None | ||
| user, | ||
| shift, | ||
| last_valid_slot_ids, |
Collaborator
There was a problem hiding this comment.
I think those are slots, not ids?
Suggested change
| last_valid_slot_ids, | |
| last_valid_slots, |
| def unregister_first_slot(self): | ||
| first_slot = self.slots[0] | ||
| first_shift_attendance = ShiftAttendance.objects.filter(slot=first_slot).first() | ||
| def unregister_slot(self, slot: ShiftSlot | None = None): |
Collaborator
There was a problem hiding this comment.
The slot parameter is never used.
Comment on lines
+233
to
+235
| self.assertTrue( | ||
| ShiftAttendance.objects.filter(slot__in=self.slots[:2]).exists() | ||
| ) |
Collaborator
There was a problem hiding this comment.
This only asserts that at least one of the slots has an attendance, we should check the count to make sure there is two, and probably filter by state too.
| Command().handle() | ||
| self.assertEqual(0, len(mail.outbox)) | ||
|
|
||
| # register user to third slot |
Collaborator
There was a problem hiding this comment.
Does that comment really explain anything that is not clear on the following line?
| slot_to_register.required_capabilities, | ||
| [ShiftUserCapability.SHIFT_COORDINATOR], | ||
| ) | ||
|
|
Collaborator
There was a problem hiding this comment.
We set that value in the test just a few lines above, is this assert necessary?
Co-authored-by: Théophile MADET <theo.madet@posteo.net>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've noticed that the current implementation doesn't allow for a notification if there are already members registered with this capability. That's why I've made changes so that the number of slots with this capability is now counted.