Resolve "Only allow one absence at any point of time" #115

Merged
hansegucker merged 12 commits from 32-only-allow-one-absence-at-any-point-of-time into master 2024-12-01 21:24:30 +01:00
Member

Closes #32

Closes #32
Author
Member

assigned to @yuha

assigned to @yuha
Author
Member

added 1 commit

  • 2f14ace5 - Add clean method checking for overlapping absences

Compare with previous version

added 1 commit <ul><li>2f14ace5 - Add clean method checking for overlapping absences</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=50695&start_sha=a29a354499a528c64e3e06b5f88edf6551f8b5db)
Author
Member

added 1 commit

  • 3e06c764 - WIP: Cut existing absences on absence creation to avoid overlaps

Compare with previous version

added 1 commit <ul><li>3e06c764 - WIP: Cut existing absences on absence creation to avoid overlaps</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=50730&start_sha=2f14ace5db7323a1e7163660f5f0d2379710474f)
Author
Member

added 1 commit

  • 4e97b71b - Cut existing absences on absence creation to avoid overlaps

Compare with previous version

added 1 commit <ul><li>4e97b71b - Cut existing absences on absence creation to avoid overlaps</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=50877&start_sha=3e06c764737b2449770eeedfab53389b8be239f2)
Author
Member

added 2 commits

  • 66f22cdd - Fix handling of new absences cutting existing ones in two halves
  • 01db56c4 - WIP: Handle overlapping absences with same reason correctly

Compare with previous version

added 2 commits <ul><li>66f22cdd - Fix handling of new absences cutting existing ones in two halves</li><li>01db56c4 - WIP: Handle overlapping absences with same reason correctly</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=50881&start_sha=4e97b71b008d934b4d306f86ec6a395c8571f8a0)
Author
Member

@hansegucker @ZugBahnHof two questions:

  1. We should probably inform the user in case of overlapping absences and the consequences of creating/editing an absence in a way that leads to overlaps (cuts to existing absences). How exactly should this happen? I'd think of something like the overview step when creating absences in the coursebook that shows which lessons will be affected.
  2. This is more related to Alsijils use of Kolego absences, but how exactly should instances that relate to Kolego absences be updates in case these said absences change?
@hansegucker @ZugBahnHof two questions: 1. We should probably inform the user in case of overlapping absences and the consequences of creating/editing an absence in a way that leads to overlaps (cuts to existing absences). How exactly should this happen? I'd think of something like the overview step when creating absences in the coursebook that shows which lessons will be affected. 2. This is more related to Alsijils use of Kolego absences, but how exactly should instances that relate to Kolego absences be updates in case these said absences change?
Author
Member

apart from that, TODO: There are now use cases for which trying to create an absence does not actually lead to an absence being created (when overlaps exist with pre-existing absences that share the same absence reason; this leads to a merge, reflected in the existing absence being updated which seems semantically correct to me). This causes problems with graphene for now since create mutations depend on the obj being created & saved having an ID to return. Probably the logic for handling overlaps should be moved to some custom mutation instead?

apart from that, TODO: There are now use cases for which trying to create an absence does not actually lead to an absence being created (when overlaps exist with pre-existing absences that share the same absence reason; this leads to a merge, reflected in the existing absence being updated which seems semantically correct to me). This causes problems with graphene for now since create mutations depend on the obj being created & saved having an ID to return. Probably the logic for handling overlaps should be moved to some custom mutation instead?
Author
Member

second one can be ignore – alsijil already does that

second one can be ignore – alsijil already does that
Author
Member

first one goes into follow-up issue

first one goes into follow-up issue
Author
Member

created #35 to continue this discussion

created #35 to continue this discussion
Author
Member

mentioned in issue #35

mentioned in issue #35
Author
Member

resolved all threads

resolved all threads
Author
Member

added 1 commit

  • 178874bc - Handle overlapping absences with same reason correctly

Compare with previous version

added 1 commit <ul><li>178874bc - Handle overlapping absences with same reason correctly</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=50960&start_sha=01db56c40a0c0030f51edd2585c687af2938df79)
Author
Member

TODO: Refresh absences list after save

TODO: Refresh absences list after save
Author
Member

TODO/to discuss: what should happen with absences that get deleted because their time span is now fully covered by a newly created/edited absence but that are used as the reference absence in existing participation statuses?

TODO/to discuss: what should happen with absences that get deleted because their time span is now fully covered by a newly created/edited absence but that are used as the reference absence in existing participation statuses?
Author
Member

@hansegucker

probably we should just replace the reference values – but how?

@hansegucker probably we should just replace the reference values – but how?
Owner

Yeah, we should update those references beforehand.

  1. Create new absence
  2. Update references
  3. Delete old absence
Yeah, we should update those references beforehand. 1. Create new absence 2. Update references 3. Delete old absence
Author
Member

added 4 commits

  • 50eee039 - Refresh absence list on create/edit
  • 21569732 - Add basic tests
  • 0a0cabbf - Fix handling of new absences outside of existing ones
  • 6b58dad8 - Fix call of parent save method

Compare with previous version

added 4 commits <ul><li>50eee039 - Refresh absence list on create/edit</li><li>21569732 - Add basic tests</li><li>0a0cabbf - Fix handling of new absences outside of existing ones</li><li>6b58dad8 - Fix call of parent save method</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=51016&start_sha=178874bc1ea84c11a91a0b5f5391c6e8f1ed700c)
Author
Member

added 3 commits

  • 94361e86 - Add basic tests
  • 7cf98d40 - Fix handling of new absences outside of existing ones
  • 6bf75d9c - Fix call of parent save method

Compare with previous version

added 3 commits <ul><li>94361e86 - Add basic tests</li><li>7cf98d40 - Fix handling of new absences outside of existing ones</li><li>6bf75d9c - Fix call of parent save method</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=51043&start_sha=6b58dad83acfd6201a6a4ea3ac4c75db1795b7b0)
Author
Member

added 2 commits

  • f0729721 - Fix handling of overlapping absences with same reason and person
  • 8ced4059 - Correctly return modified objects in mutation

Compare with previous version

added 2 commits <ul><li>f0729721 - Fix handling of overlapping absences with same reason and person</li><li>8ced4059 - Correctly return modified objects in mutation</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=51151&start_sha=6bf75d9c087721cc61e1a49c2e14d8caa76b99bf)
Author
Member

TODO: actually remove absences from CRUD list when saving leads to deletion (somehow update apollo cache)

TODO: actually remove absences from CRUD list when saving leads to deletion (somehow update apollo cache)
Author
Member

created #36 to continue this discussion

created #36 to continue this discussion
Author
Member

mentioned in issue #36

mentioned in issue #36
Author
Member

added 2 commits

  • 4838125c - Add classmethod that gets/creates one absence for given time span
  • c4ddcca2 - Reformat

Compare with previous version

added 2 commits <ul><li>4838125c - Add classmethod that gets/creates one absence for given time span</li><li>c4ddcca2 - Reformat</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=51197&start_sha=8ced4059db4b18c0d355581a78c0f2f503ef7ebc)
Author
Member

resolved all threads

resolved all threads
Author
Member

assigned to @hansegucker and unassigned @yuha

assigned to @hansegucker and unassigned @yuha
Author
Member

marked this merge request as ready

marked this merge request as **ready**
Owner

added 2 commits

  • 812c00fe - Refactor overlapping logic
  • a7a6b029 - Add migration for existing overlapping absences

Compare with previous version

added 2 commits <ul><li>812c00fe - Refactor overlapping logic</li><li>a7a6b029 - Add migration for existing overlapping absences</li></ul> [Compare with previous version](/AlekSIS/onboarding/AlekSIS-App-Kolego/-/merge_requests/52/diffs?diff_id=51209&start_sha=c4ddcca20836bcd3fb5a29d24d8fb6b89e2b80dc)
Owner
                else datetime.combine(self.date_start, time.min)
```suggestion:-0+0 else datetime.combine(self.date_start, time.min) ```
Owner
                else datetime.combine(self.date_end, time.max)
```suggestion:-0+0 else datetime.combine(self.date_end, time.max) ```
Owner
    def save(self, *args, skip_overlap_handling: bool=False, **kwargs):
```suggestion:-0+0 def save(self, *args, skip_overlap_handling: bool=False, **kwargs): ```
Owner
                else datetime.combine(self.date_start, datetime.time.min)
```suggestion:-0+0 else datetime.combine(self.date_start, datetime.time.min) ```
Owner
                else datetime.combine(self.date_end, datetime.time.max)
```suggestion:-0+0 else datetime.combine(self.date_end, datetime.time.max) ```
Owner
                    event_within.datetime_start
```suggestion:-0+0 event_within.datetime_start ```
Owner
                    event_within.datetime_end
```suggestion:-0+0 event_within.datetime_end ```
Owner

resolved all threads

resolved all threads
Owner

mentioned in commit 7bac57ffa5

mentioned in commit 7bac57ffa5b56161f7e537bacd127492cd8a5a3c
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
aleksis/AlekSIS-App-Kolego!115
No description provided.