From 31dd27c255742521fdf530737815be07e76cf3fe Mon Sep 17 00:00:00 2001 From: MoritzWeber Date: Fri, 20 Sep 2024 14:10:29 +0200 Subject: [PATCH] feat: Hide "Sessions" part from feedback email if no sessions --- backend/capellacollab/feedback/util.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/capellacollab/feedback/util.py b/backend/capellacollab/feedback/util.py index 32a846fa6..99f68af05 100644 --- a/backend/capellacollab/feedback/util.py +++ b/backend/capellacollab/feedback/util.py @@ -67,10 +67,12 @@ def format_email( ] if feedback.trigger: message_list.append(f"Trigger: {feedback.trigger}") - message_list.append("Sessions:") - message_list += [ - session.model_dump_json(indent=2) for session in feedback.sessions - ] + + if feedback.sessions: + message_list.append("Sessions:") + message_list += [ + session.model_dump_json(indent=2) for session in feedback.sessions + ] message_list.append("---") message_list.append(