V10.583 補 Paula PChome Nick 比價對齊
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s
All checks were successful
CD Pipeline / deploy (push) Successful in 1m7s
This commit is contained in:
@@ -1642,6 +1642,29 @@ def _has_cushion_refill_pack_alignment(left: ProductIdentity, right: ProductIden
|
||||
return aligned(left, right) or aligned(right, left)
|
||||
|
||||
|
||||
def _has_paulas_choice_body_lotion_210ml_2pack_alignment(
|
||||
left: ProductIdentity,
|
||||
right: ProductIdentity,
|
||||
) -> bool:
|
||||
"""Align PChome Nick `210ml x2` with MOMO `210ml二入` for the same body lotion."""
|
||||
brand_tokens = left.brand_tokens | right.brand_tokens
|
||||
if not ({"寶拉珍選", "paulas", "choice"} & brand_tokens):
|
||||
return False
|
||||
if not _has_shared_volume(left, right, 210):
|
||||
return False
|
||||
if not all("水楊酸" in item.searchable_name and "身體乳" in item.searchable_name for item in (left, right)):
|
||||
return False
|
||||
|
||||
def has_two_pack(identity: ProductIdentity) -> bool:
|
||||
text = identity.searchable_name
|
||||
return bool(
|
||||
re.search(r"(?:x\s*2|2\s*入|二\s*入|兩\s*入|雙\s*入|雙入組|二入組|兩入組)", text, re.I)
|
||||
or (2, "入") in identity.counts
|
||||
)
|
||||
|
||||
return has_two_pack(left) and has_two_pack(right)
|
||||
|
||||
|
||||
def _has_refill_pack(identity: ProductIdentity) -> bool:
|
||||
text = identity.normalized_name
|
||||
return bool(
|
||||
@@ -2328,10 +2351,17 @@ def score_marketplace_match(
|
||||
if bundle_offer_conflict:
|
||||
reasons.append("bundle_offer_conflict")
|
||||
cushion_refill_pack_alignment = _has_cushion_refill_pack_alignment(left, right)
|
||||
if _has_multi_component(left) != _has_multi_component(right) and not cushion_refill_pack_alignment:
|
||||
paulas_choice_body_lotion_2pack_alignment = _has_paulas_choice_body_lotion_210ml_2pack_alignment(left, right)
|
||||
if (
|
||||
_has_multi_component(left) != _has_multi_component(right)
|
||||
and not cushion_refill_pack_alignment
|
||||
and not paulas_choice_body_lotion_2pack_alignment
|
||||
):
|
||||
reasons.append("multi_component_conflict")
|
||||
if cushion_refill_pack_alignment:
|
||||
reasons.append("cushion_refill_pack_alignment")
|
||||
if paulas_choice_body_lotion_2pack_alignment:
|
||||
reasons.append("paulas_choice_body_lotion_210ml_2pack_alignment")
|
||||
multi_component_count_conflict = (
|
||||
_has_multi_component(left)
|
||||
and _has_multi_component(right)
|
||||
@@ -2496,7 +2526,11 @@ def score_marketplace_match(
|
||||
hard_veto = brand_conflict or spec_conflict
|
||||
if bundle_offer_conflict:
|
||||
hard_veto = True
|
||||
if _has_multi_component(left) != _has_multi_component(right) and not cushion_refill_pack_alignment:
|
||||
if (
|
||||
_has_multi_component(left) != _has_multi_component(right)
|
||||
and not cushion_refill_pack_alignment
|
||||
and not paulas_choice_body_lotion_2pack_alignment
|
||||
):
|
||||
hard_veto = True
|
||||
if multi_component_count_conflict:
|
||||
hard_veto = True
|
||||
|
||||
Reference in New Issue
Block a user