make sure to add all constraint types to return
This commit is contained in:
parent
f1fa519f31
commit
eb8138eaf9
@ -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)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user