This commit is contained in:
@@ -483,12 +483,24 @@ def _spec_mention_count(identity: ProductIdentity) -> int:
|
||||
|
||||
|
||||
def _has_overlapping_base_spec(left: ProductIdentity, right: ProductIdentity) -> bool:
|
||||
for left_value in left.volumes_ml:
|
||||
if any(_close_number(left_value, right_value) for right_value in right.volumes_ml):
|
||||
return True
|
||||
for left_value in left.weights_g:
|
||||
if any(_close_number(left_value, right_value) for right_value in right.weights_g):
|
||||
return True
|
||||
left_volumes = tuple(sorted(set(left.volumes_ml)))
|
||||
right_volumes = tuple(sorted(set(right.volumes_ml)))
|
||||
if left_volumes or right_volumes:
|
||||
if not left_volumes or not right_volumes:
|
||||
return False
|
||||
if len(left_volumes) > 1 or len(right_volumes) > 1:
|
||||
return False
|
||||
return _close_number(left_volumes[0], right_volumes[0])
|
||||
|
||||
left_weights = tuple(sorted(set(left.weights_g)))
|
||||
right_weights = tuple(sorted(set(right.weights_g)))
|
||||
if left_weights or right_weights:
|
||||
if not left_weights or not right_weights:
|
||||
return False
|
||||
if len(left_weights) > 1 or len(right_weights) > 1:
|
||||
return False
|
||||
return _close_number(left_weights[0], right_weights[0])
|
||||
|
||||
return False
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user