From 9a5329fc497a2287aa5952b779d1e56db8e84d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micka=C3=ABl=20Misbach?= Date: Thu, 7 Dec 2023 17:21:34 +0100 Subject: [PATCH] [uss_qualifier] Add suffix for notes with duplicated keys (#390) --- monitoring/uss_qualifier/scenarios/scenario.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/monitoring/uss_qualifier/scenarios/scenario.py b/monitoring/uss_qualifier/scenarios/scenario.py index 73bc509531..6b8827fa3a 100644 --- a/monitoring/uss_qualifier/scenarios/scenario.py +++ b/monitoring/uss_qualifier/scenarios/scenario.py @@ -280,6 +280,14 @@ def record_note(self, key: str, message: str) -> None: ) if "notes" not in self._scenario_report: self._scenario_report.notes = {} + + if key in self._scenario_report.notes: + # prevent notes from being overriden by adding a suffix if key is a duplicate + suffix = 1 + while f"{key}_{suffix}" in self._scenario_report.notes: + suffix += 1 + key += f"_{suffix}" + self._scenario_report.notes[key] = Note( message=message, timestamp=StringBasedDateTime(arrow.utcnow().datetime),