From 780fb8f270b8d9ae6563af1df5732ad9382eb260 Mon Sep 17 00:00:00 2001 From: Carina Antunes <carina.oliveira.antunes@cern.ch> Date: Thu, 21 Oct 2021 18:14:35 +0200 Subject: [PATCH] [hotfix] category name --- notifications_routing/router.py | 2 +- notifications_routing/utils.py | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/notifications_routing/router.py b/notifications_routing/router.py index 77a64e4..e6a0696 100644 --- a/notifications_routing/router.py +++ b/notifications_routing/router.py @@ -68,7 +68,7 @@ class Router(megabus.Listener): category_name = ( channel[str(InputMessageKeys.CATEGORY)][str(InputMessageKeys.NAME)] - if InputMessageKeys.CATEGORY in channel + if str(InputMessageKeys.CATEGORY) in channel else None ) diff --git a/notifications_routing/utils.py b/notifications_routing/utils.py index 9405a74..813666a 100644 --- a/notifications_routing/utils.py +++ b/notifications_routing/utils.py @@ -20,7 +20,7 @@ class InputMessageKeys(StrEnum): TARGET = "target" ID = "id" NAME = "name" - CATEGORY = "category_name" + CATEGORY = "category" SLUG = "slug" PRIORITY = "priority" SENT_AT = "sentAt" @@ -85,11 +85,9 @@ def convert_notification_email_to_json_string(message, email): "priority": message[OutputMessageKeys.PRIORITY], "notification_id": message[OutputMessageKeys.ID], "created_at": message[OutputMessageKeys.CREATED_TIMESTAMP], + "category_name": message[OutputMessageKeys.CHANNEL_CATEGORY], } - if str(OutputMessageKeys.CHANNEL_CATEGORY) in message: - notif["category_name"] = message[OutputMessageKeys.CHANNEL_CATEGORY] - return json.dumps(notif) -- GitLab