From d98c789482b73eefd598d4cc95b1585316ac908f Mon Sep 17 00:00:00 2001 From: Felix Blanke <felixblanke@uni-bonn.de> Date: Thu, 3 Apr 2025 12:12:54 +0200 Subject: [PATCH] Rename method to AKCategory.create_category_optimizer_constraints --- AKModel/models.py | 8 ++++---- AKModel/tests/test_json_export.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/AKModel/models.py b/AKModel/models.py index 542a9b98..3b560e3f 100644 --- a/AKModel/models.py +++ b/AKModel/models.py @@ -364,7 +364,7 @@ class Event(models.Model): :yield: Block of optimizer timeslots as the discretization result. :ytype: list of OptimizerTimeslot """ - all_category_constraints = AKCategory.create_category_constraints( + all_category_constraints = AKCategory.create_category_optimizer_constraints( AKCategory.objects.filter(event=self).all() ) @@ -389,7 +389,7 @@ class Event(models.Model): slot_index = 0 for block_slot in DefaultSlot.objects.filter(event=self).order_by("start", "end"): - category_constraints = AKCategory.create_category_constraints( + category_constraints = AKCategory.create_category_optimizer_constraints( block_slot.primary_categories.all() ) @@ -760,7 +760,7 @@ class AKCategory(models.Model): return self.name @staticmethod - def create_category_constraints(categories: Iterable["AKCategory"]) -> set[str]: + def create_category_optimizer_constraints(categories: Iterable["AKCategory"]) -> set[str]: """Create a set of constraint strings from an AKCategory iterable. :param categories: The iterable of categories to derive the constraint strings from. @@ -1265,7 +1265,7 @@ class AKSlot(models.Model): data["time_constraints"].extend(_owner_time_constraints(owner)) if self.ak.category: - category_constraints = AKCategory.create_category_constraints([self.ak.category]) + category_constraints = AKCategory.create_category_optimizer_constraints([self.ak.category]) data["time_constraints"].extend(category_constraints) if self.fixed and self.room is not None: diff --git a/AKModel/tests/test_json_export.py b/AKModel/tests/test_json_export.py index e6b0a435..f0cbba1c 100644 --- a/AKModel/tests/test_json_export.py +++ b/AKModel/tests/test_json_export.py @@ -328,7 +328,7 @@ class JSONExportTest(TestCase): # add time constraints for AK category if slot.ak.category: - category_constraints = AKCategory.create_category_constraints( + category_constraints = AKCategory.create_category_optimizer_constraints( [slot.ak.category] ) time_constraints |= category_constraints @@ -597,7 +597,7 @@ class JSONExportTest(TestCase): # add category constraints fulfilled_time_constraints |= ( - AKCategory.create_category_constraints( + AKCategory.create_category_optimizer_constraints( [ cat for cat in AKCategory.objects.filter( -- GitLab