fix: only notify for genuinely new ads, not every ad on page
This commit is contained in:
+7
-6
@@ -74,6 +74,13 @@ async def scheduler_task(pool: object, bot: ExtBot) -> None:
|
||||
fields.get("main_image_url"), fields.get("postcode"), fields.get("modified_at"),
|
||||
)
|
||||
ad_uuid = str(ad_row["id"])
|
||||
|
||||
# Only notify for genuinely new ads after baseline load is done
|
||||
if initial_loaded:
|
||||
notify_fields = {**fields, "keyword": keyword}
|
||||
for tg_id in telegram_ids:
|
||||
await notify_new_ad(bot, tg_id, notify_fields)
|
||||
new_count += 1
|
||||
else:
|
||||
ad_uuid = str(existing["id"])
|
||||
old_price = existing["price"]
|
||||
@@ -96,12 +103,6 @@ async def scheduler_task(pool: object, bot: ExtBot) -> None:
|
||||
fields.get("main_image_url"), fields.get("postcode"), ad_uuid,
|
||||
)
|
||||
|
||||
if initial_loaded:
|
||||
notify_fields = {**fields, "keyword": keyword}
|
||||
for tg_id in telegram_ids:
|
||||
await notify_new_ad(bot, tg_id, notify_fields)
|
||||
new_count += 1
|
||||
|
||||
if is_price_drop:
|
||||
notify_fields = {**fields, "keyword": keyword}
|
||||
for tg_id in telegram_ids:
|
||||
|
||||
Reference in New Issue
Block a user