From 873ce8b7edba7d0ff855748fbf1b7aeef1351fd8 Mon Sep 17 00:00:00 2001 From: Pedro Gallardo Date: Fri, 3 Nov 2023 09:42:19 -0300 Subject: [PATCH] fix: handling duplicated oids --- metadata_step/metadata_step/step.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/metadata_step/metadata_step/step.py b/metadata_step/metadata_step/step.py index 2f84cef04..1ff8cde23 100644 --- a/metadata_step/metadata_step/step.py +++ b/metadata_step/metadata_step/step.py @@ -30,7 +30,9 @@ def _write_metadata_into_db(self, result: List[Dict]): # Output format: [{oid: OID, ss: SS_DATA, ...}] def execute(self, messages: List[Dict]): - oids = list(set([message["oid"] for message in messages])) + unique = {message["oid"]: message for message in messages} + oids = list(unique.keys()) + messages = list(unique.values()) catalogs = {"ps1": {}, "gaia": {}} with self.db.session() as session: catalogs["ps1"] = get_ps1_catalog(session, oids)