Skip to content

Commit

Permalink
[uss_qualifier] Add suffix for notes with duplicated keys (interuss#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
mickmis authored Dec 7, 2023
1 parent f5b0ab0 commit 9a5329f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions monitoring/uss_qualifier/scenarios/scenario.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down

0 comments on commit 9a5329f

Please sign in to comment.