Update monitoring PF competitor tracking

This commit is contained in:
Grendgi
2026-06-05 12:31:52 +03:00
parent 6966e6810c
commit 7a4d03c905
4 changed files with 156 additions and 80 deletions

View File

@@ -15,8 +15,6 @@ from app.models import Project
from app.services.monitor import (
BAYUT_ENABLED,
add_competitor_url,
_format_listing_added,
notify_project_changes,
run_check_all,
run_check_for_project,
sync_permit_competitors,
@@ -66,7 +64,6 @@ def cmd_add_listing(payload: dict[str, Any]) -> None:
listing, err = add_competitor_url(db, project, url)
if err:
_fail(err)
notify_project_changes(project, [_format_listing_added(project, listing, auto=False)])
_write({"listing_id": listing.id})
finally:
db.close()
@@ -83,7 +80,6 @@ def cmd_add_listings(payload: dict[str, Any]) -> None:
added = 0
skipped = 0
errors: list[str] = []
notifications: list[str] = []
seen: set[str] = set()
for raw in urls:
url = str(raw or "").strip()
@@ -97,9 +93,6 @@ def cmd_add_listings(payload: dict[str, Any]) -> None:
errors.append(err)
else:
added += 1
notifications.append(_format_listing_added(project, listing, auto=False))
if notifications:
notify_project_changes(project, notifications)
_write({"added": added, "skipped": skipped, "errors": errors})
finally:
db.close()