From eb8138eaf9480323e31284b2c80e561b9b960c0d Mon Sep 17 00:00:00 2001 From: Joshua Burman Date: Sun, 12 Nov 2023 18:37:29 -0500 Subject: [PATCH] make sure to add all constraint types to return --- app/models/solver_run.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/solver_run.py b/app/models/solver_run.py index a9a6d00..77df041 100644 --- a/app/models/solver_run.py +++ b/app/models/solver_run.py @@ -69,7 +69,7 @@ class SolverRun(BaseModel): if bundle.id == bundle_id: return bundle - def get_constraint_by_type(self, type: str) -> Constraint or None: + def get_constraint_by_type(self, type: str) -> GenericConstraint|MetadataConstraint|BundleConstraint|FormUniquenessConstraint|TotalFormItemsConstraint or None: for constraint in self.constraints: if type == constraint.reference_attribute.type: return constraint @@ -130,7 +130,7 @@ class SolverRun(BaseModel): logging.info('Bundles Generated...') - def get_constraint(self, name: str) -> Constraint: + def get_constraint(self, name: str) -> GenericConstraint|MetadataConstraint|BundleConstraint|FormUniquenessConstraint|TotalFormItemsConstraint: return next((constraint for constraint in self.constraints if constraint.reference_attribute.id == name), None)