fix(amazon): parse eu and us price decimal formats

This commit is contained in:
Anish Sarkar 2026-07-15 15:32:11 +05:30
parent 82e4272834
commit 53ccf575a6

View file

@ -87,7 +87,15 @@ def _float(value: str | None) -> float | None:
if not match:
return None
token = match.group(0)
if token.count(",") == 1 and "." not in token and len(token.rsplit(",", 1)[1]) <= 2:
if "," in token and "." in token:
decimal = "," if token.rfind(",") > token.rfind(".") else "."
grouping = "." if decimal == "," else ","
token = token.replace(grouping, "").replace(decimal, ".")
elif (
token.count(",") == 1
and "." not in token
and len(token.rsplit(",", 1)[1]) <= 2
):
token = token.replace(",", ".")
else:
token = token.replace(",", "")