From 8e6b18c888d3df68735888b17a2f074106c353bf Mon Sep 17 00:00:00 2001 From: Theodlz Date: Wed, 4 Oct 2023 17:17:36 -0700 Subject: [PATCH] remove block like on main --- kowalski/alert_brokers/alert_broker.py | 31 -------------------------- 1 file changed, 31 deletions(-) diff --git a/kowalski/alert_brokers/alert_broker.py b/kowalski/alert_brokers/alert_broker.py index da55d969..3b75138c 100644 --- a/kowalski/alert_brokers/alert_broker.py +++ b/kowalski/alert_brokers/alert_broker.py @@ -1803,37 +1803,6 @@ def alert_sentinel_skyportal(self, alert, prv_candidates, passed_filters): # post alert photometry in single call to /api/photometry alert["prv_candidates"] = prv_candidates - # also get all the alerts for this object, to make sure to have all the detections - try: - all_alerts = list( - retry(self.mongo.db[self.collection_alerts].find)( - { - "objectId": alert["objectId"], - "candid": {"$ne": alert["candid"]}, - }, - { - "candidate": 1, - }, - ) - ) - all_alerts = [ - {**a["candidate"]} for a in all_alerts if "candidate" in a - ] - # add to prv_candidates the detections that are not already in there - # use the jd and the fid to match - for a in all_alerts: - if not any( - [ - (a["jd"] == p["jd"]) and (a["fid"] == p["fid"]) - for p in alert["prv_candidates"] - ] - ): - alert["prv_candidates"].append(a) - del all_alerts - except Exception as e: - # this should never happen, but just in case - log(f"Failed to get all alerts for {alert['objectId']}: {e}") - self.alert_put_photometry(alert) if len(autosave_group_ids):