cleanup and < 3 bundle pre-filter

This commit is contained in:
Adrian Manteza
2022-03-24 16:47:55 +00:00
parent 79580c5394
commit 6ebe33a76b
4 changed files with 12 additions and 9 deletions

View File

@ -86,6 +86,12 @@ class SolverRun(BaseModel):
items=[item],
type=type_attribute)
]
# temporary compensator for bundle item limits, since we shouldn't be using cases with less than 3 items
# ideally this should be in the bundles model as a new attribute to handle "constraints of constraints"
logging.info('Removing bundles with items < 3')
for k,v in enumerate(self.bundles):
bundle = self.bundles[k]
if bundle.count < 3: del self.bundles[k]
logging.info('Bundles Generated...')
@ -94,4 +100,7 @@ class SolverRun(BaseModel):
if constraint.reference_attribute.id == name), None)
def unbundled_items(self) -> list:
# since the only bundles are based on passage id currently
# in the future when we have more than just passage based bundles
# we'll need to develop a more sophisticated way of handling this concern
return [item for item in self.items if item.passage_id == None]