Merge pull request #7 from prosolis/claude/fix-cheapshark-rating-bug-pxVJv
Fix cheapshark rating and sorting issue
This commit is contained in:
@@ -46,8 +46,8 @@ async def fetch_deals(
|
|||||||
client: httpx.AsyncClient,
|
client: httpx.AsyncClient,
|
||||||
*,
|
*,
|
||||||
max_price: float = 20,
|
max_price: float = 20,
|
||||||
min_rating: int = 80,
|
min_rating: float = 8.0,
|
||||||
min_discount: int = 50,
|
min_discount: float = 50,
|
||||||
page_size: int = 10,
|
page_size: int = 10,
|
||||||
) -> list[CheapSharkDeal]:
|
) -> list[CheapSharkDeal]:
|
||||||
"""Fetch top deals from CheapShark across configured stores."""
|
"""Fetch top deals from CheapShark across configured stores."""
|
||||||
@@ -55,7 +55,7 @@ async def fetch_deals(
|
|||||||
params = {
|
params = {
|
||||||
"storeID": store_ids,
|
"storeID": store_ids,
|
||||||
"upperPrice": str(int(max_price)),
|
"upperPrice": str(int(max_price)),
|
||||||
"sortBy": "Deal Rating",
|
"sortBy": "recent",
|
||||||
"desc": "1",
|
"desc": "1",
|
||||||
"pageSize": str(page_size),
|
"pageSize": str(page_size),
|
||||||
}
|
}
|
||||||
@@ -81,7 +81,7 @@ async def fetch_deals(
|
|||||||
if savings < min_discount:
|
if savings < min_discount:
|
||||||
logger.debug("Filtered out %s: savings %.1f%% < %.1f%%", title, savings, min_discount)
|
logger.debug("Filtered out %s: savings %.1f%% < %.1f%%", title, savings, min_discount)
|
||||||
continue
|
continue
|
||||||
if rating < min_rating:
|
if rating > 0 and rating < min_rating:
|
||||||
logger.debug("Filtered out %s: rating %.1f < %.1f", title, rating, min_rating)
|
logger.debug("Filtered out %s: rating %.1f < %.1f", title, rating, min_rating)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user