From 53ccf575a60e2d4a41595b81036dc94363e3f3c6 Mon Sep 17 00:00:00 2001 From: Anish Sarkar <104695310+AnishSarkar22@users.noreply.github.com> Date: Wed, 15 Jul 2026 15:32:11 +0530 Subject: [PATCH] fix(amazon): parse eu and us price decimal formats --- .../app/proprietary/platforms/amazon/parsers.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/surfsense_backend/app/proprietary/platforms/amazon/parsers.py b/surfsense_backend/app/proprietary/platforms/amazon/parsers.py index 434973677..4e8f1f487 100644 --- a/surfsense_backend/app/proprietary/platforms/amazon/parsers.py +++ b/surfsense_backend/app/proprietary/platforms/amazon/parsers.py @@ -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(",", "")