Skip to content
This repository was archived by the owner on Sep 28, 2024. It is now read-only.

Commit

Permalink
Fix issue with NoE
Browse files Browse the repository at this point in the history
  • Loading branch information
fedecalendino committed Jul 10, 2023
1 parent 6c16d94 commit 143520e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions nintendeals/noe/api/nintendo.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,20 @@ def _search(query: str = "*", nsuid: str = None, platform: Platforms = None) ->
for data in json:
nsuids = data.get("nsuid_txt", [])
product_codes = data["product_code_txt"] = [
pc.replace("-", "") for pc in data.get("product_code_txt", []) if pc[:3] in PRODUCT_CODE_PREFIXES
pc.replace("-", "") for pc in data.get("product_code_txt", []) if pc[:3] == PRODUCT_CODE_PREFIXES
]

if not any((nsuids, product_codes)):
continue

data["nsuid_txt"] = nsuids[0] if nsuids else 0
data["product_code_txt"] = product_codes[0] if product_codes else 0
for i in range(0, max(len(nsuids), len(product_codes))):
nsuid = nsuids[i] if i < len(nsuids) else None
product_code = product_codes[i] if i < len(product_codes) else None

yield data
data["nsuid_txt"] = nsuid
data["product_code_txt"] = product_code

yield data


def search_by_nsuid(nsuid: str) -> Optional[dict]:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ documentation = "https://github.com/fedecalendino/nintendeals/blob/main/README.m
homepage = "https://github.com/fedecalendino/nintendeals"
license = "MIT"
readme = "README.md"
version = "3.1.0"
version = "3.1.1"

authors = [
"Fede Calendino <[email protected]>",
Expand Down

0 comments on commit 143520e

Please sign in to comment.