Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 520-akowner
  • 520-fix-event-wizard-datepicker
  • 520-fix-scheduling
  • 520-improve-scheduling
  • 520-improve-scheduling-2
  • 520-improve-submission
  • 520-improve-trackmanager
  • 520-improve-wall
  • 520-message-resolved
  • 520-status
  • 520-upgrades
  • add_express_interest_to_ak_overview
  • admin-production-color
  • bugfixes
  • csp
  • featire-ical-export
  • feature-ak-requirement-lists
  • feature-akslide-export-better-filename
  • feature-akslides
  • feature-better-admin
  • feature-better-cv-list
  • feature-colors
  • feature-constraint-checking
  • feature-constraint-checking-wip
  • feature-dashboard-history-button
  • feature-event-status
  • feature-event-wizard
  • feature-export-flag
  • feature-improve-admin
  • feature-improve-filters
  • feature-improved-user-creation-workflow
  • feature-interest-view
  • feature-mails
  • feature-modular-status
  • feature-plan-autoreload
  • feature-present-default
  • feature-register-link
  • feature-remaining-constraint-validation
  • feature-room-import
  • feature-scheduler-improve
  • feature-scheduling-2.0
  • feature-special-attention
  • feature-time-input
  • feature-tracker
  • feature-wiki-wishes
  • feature-wish-slots
  • feature-wizard-buttons
  • features-availabilities
  • fix-ak-times-above-folg
  • fix-api
  • fix-constraint-violation-string
  • fix-cv-checking
  • fix-default-slot-length
  • fix-default-slot-localization
  • fix-doc-minor
  • fix-duration-display
  • fix-event-tz-pytz-update
  • fix-history-interest
  • fix-interest-view
  • fix-js
  • fix-pipeline
  • fix-plan-timezone-now
  • fix-room-add
  • fix-scheduling-drag
  • fix-slot-defaultlength
  • fix-timezone
  • fix-translation-scheduling
  • fix-virtual-room-admin
  • fix-wizard-csp
  • font-locally
  • improve-admin
  • improve-online
  • improve-slides
  • improve-submission-coupling
  • interest_restriction
  • main
  • master
  • meta-debug-toolbar
  • meta-export
  • meta-makemessages
  • meta-performance
  • meta-tests
  • meta-tests-gitlab-test
  • meta-upgrades
  • mollux-master-patch-02906
  • port-availabilites-fullcalendar
  • qs
  • remove-tags
  • renovate/configure
  • renovate/django-4.x
  • renovate/django-5.x
  • renovate/django-bootstrap-datepicker-plus-5.x
  • renovate/django-bootstrap5-23.x
  • renovate/django-bootstrap5-24.x
  • renovate/django-compressor-4.x
  • renovate/django-debug-toolbar-4.x
  • renovate/django-registration-redux-2.x
  • renovate/django-simple-history-3.x
  • renovate/django-split-settings-1.x
  • renovate/django-timezone-field-5.x
100 results

Target

Select target project
  • konstantin/akplanning
  • matedealer/akplanning
  • kif/akplanning
  • mirco/akplanning
  • lordofthevoid/akplanning
  • voidptr/akplanning
  • xayomer/akplanning-fork
  • mollux/akplanning
  • neumantm/akplanning
  • mmarx/akplanning
  • nerf/akplanning
  • felix_bonn/akplanning
  • sebastian.uschmann/akplanning
13 results
Select Git revision
  • komasolver
  • main
  • renovate/django_csp-4.x
3 results
Show changes
Commits on Source (1)
...@@ -425,7 +425,6 @@ class ConstraintViolation(models.Model): ...@@ -425,7 +425,6 @@ class ConstraintViolation(models.Model):
return ", ".join(output) return ", ".join(output)
get_details.short_description = _('Details') get_details.short_description = _('Details')
# TODO Automatically save this
aks_tmp = set() aks_tmp = set()
@property @property
def _aks(self): def _aks(self):
...@@ -459,9 +458,31 @@ class ConstraintViolation(models.Model): ...@@ -459,9 +458,31 @@ class ConstraintViolation(models.Model):
return set(self.ak_slots.all()) return set(self.ak_slots.all())
return self.ak_slots_tmp return self.ak_slots_tmp
def save(self, *args, **kwargs):
super().save(*args, **kwargs)
# Store temporary m2m-relations in db
for ak in self.aks_tmp:
self.aks.add(ak)
for ak_slot in self.ak_slots_tmp:
self.ak_slots.add(ak_slot)
def __str__(self): def __str__(self):
return f"{self.get_level_display()}: {self.get_type_display()} [{self.get_details()}]" return f"{self.get_level_display()}: {self.get_type_display()} [{self.get_details()}]"
def __eq__(self, other): def __eq__(self, other):
# TODO Check if FIELDS and FIELDS_MM are equal if not isinstance(other, ConstraintViolation):
return super().__eq__(other) return False
if self.type != other.type:
return False
for field_mm in self.FIELDS_MM:
s: set = getattr(self, field_mm)
o: set = getattr(other, field_mm)
if len(s) != len(o):
return False
if len(s.intersection(o)) != len(s):
return False
for field in self.FIELDS:
if getattr(self, field) != getattr(other, field):
return False
return True
...@@ -14,7 +14,7 @@ def ak_changed_handler(sender, instance: AK, **kwargs): ...@@ -14,7 +14,7 @@ def ak_changed_handler(sender, instance: AK, **kwargs):
# Owner might have changed: Might affect multiple AKs by the same owner at the same time # Owner might have changed: Might affect multiple AKs by the same owner at the same time
conflicts = [] conflicts = []
type = ConstraintViolation.ViolationType.OWNER_TWO_SLOTS violation_type = ConstraintViolation.ViolationType.OWNER_TWO_SLOTS
# For all owners... # For all owners...
for owner in instance.owners.all(): for owner in instance.owners.all():
# ...find overlapping AKs... # ...find overlapping AKs...
...@@ -30,9 +30,8 @@ def ak_changed_handler(sender, instance: AK, **kwargs): ...@@ -30,9 +30,8 @@ def ak_changed_handler(sender, instance: AK, **kwargs):
for slot in slots_by_owner_this_ak: for slot in slots_by_owner_this_ak:
for other_slot in slots_by_owner: for other_slot in slots_by_owner:
if slot.overlaps(other_slot): if slot.overlaps(other_slot):
# TODO Create ConstraintViolation here
c = ConstraintViolation( c = ConstraintViolation(
type=type, type=violation_type,
level=ConstraintViolation.ViolationLevel.VIOLATION, level=ConstraintViolation.ViolationLevel.VIOLATION,
event=event, event=event,
ak_owner=owner ak_owner=owner
...@@ -44,12 +43,26 @@ def ak_changed_handler(sender, instance: AK, **kwargs): ...@@ -44,12 +43,26 @@ def ak_changed_handler(sender, instance: AK, **kwargs):
conflicts.append(c) conflicts.append(c)
print(f"{owner} has the following conflicts: {conflicts}") print(f"{owner} has the following conflicts: {conflicts}")
# ... and compare to/update list of existing violations of this type: # ... and compare to/update list of existing violations of this type:
current_violations = instance.constraintviolation_set.filter(type=type) current_violations = list(instance.constraintviolation_set.filter(type=violation_type))
print(current_violations)
for conflict in conflicts: for conflict in conflicts:
pass # eq_violation_index = -1
try:
current_violations.remove(conflict)
print(f"Found existing conflict {conflict}")
except ValueError:
conflict.save()
"""for i, other_violation in enumerate(current_violations):
if conflict == other_violation:
eq_violation_index = i
break
if eq_violation_index > -1:"""
# TODO Remove from list of current_violations if an equal new one is found # TODO Remove from list of current_violations if an equal new one is found
# TODO Otherwise, store this conflict in db # TODO Otherwise, store this conflict in db
# conflict.save()
# TODO Remove all violations still in current_violations # TODO Remove all violations still in current_violations
for old_violation in current_violations:
old_violation.delete()
@receiver(post_save, sender=AKSlot) @receiver(post_save, sender=AKSlot)
......