From bf628f72cef60da2fa051cc88bf722baa7cec49b Mon Sep 17 00:00:00 2001 From: Theophile du Laz Date: Wed, 14 Feb 2024 01:10:12 -0800 Subject: [PATCH] Auto follow-up: add missing filter templating step (#276) * add templating on fp_hists in auto_followup pipeline to avoid error when running the filters --- kowalski/alert_brokers/alert_broker_ztf.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/kowalski/alert_brokers/alert_broker_ztf.py b/kowalski/alert_brokers/alert_broker_ztf.py index ad4e91e7..bd8dbc4f 100644 --- a/kowalski/alert_brokers/alert_broker_ztf.py +++ b/kowalski/alert_brokers/alert_broker_ztf.py @@ -378,6 +378,15 @@ def make_filter_templates(self, active_filters: Sequence): ]["$filter"]["cond"]["$and"][0]["$in"][1] = active_filter[ "permissions" ] + if ( + "fp_hists" + in active_filter["autosave"]["pipeline"][3]["$project"] + ): + active_filter["autosave"]["pipeline"][3]["$project"][ + "fp_hists" + ]["$filter"]["cond"]["$and"][0]["$in"][1] = active_filter[ + "permissions" + ] # same for the auto_followup pipeline: if ( isinstance(active_filter.get("auto_followup", None), dict) @@ -396,6 +405,15 @@ def make_filter_templates(self, active_filters: Sequence): ]["$filter"]["cond"]["$and"][0]["$in"][1] = active_filter[ "permissions" ] + if ( + "fp_hists" + in active_filter["auto_followup"]["pipeline"][3]["$project"] + ): + active_filter["auto_followup"]["pipeline"][3]["$project"][ + "fp_hists" + ]["$filter"]["cond"]["$and"][0]["$in"][1] = active_filter[ + "permissions" + ] filter_template = { "group_id": active_filter["group_id"],