From 12b50112666c7a4adf76294a28dc825a142e38d2 Mon Sep 17 00:00:00 2001 From: wh1te909 <7434746+wh1te909@users.noreply.github.com> Date: Wed, 5 Jun 2024 05:33:16 +0000 Subject: [PATCH] fix tests --- api/tacticalrmm/alerts/serializers.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/tacticalrmm/alerts/serializers.py b/api/tacticalrmm/alerts/serializers.py index afbbb015..5ed560c0 100644 --- a/api/tacticalrmm/alerts/serializers.py +++ b/api/tacticalrmm/alerts/serializers.py @@ -35,16 +35,19 @@ class AlertTemplateSerializer(ModelSerializer): fields = "__all__" def get_action_name(self, obj): - if obj.action_type == AlertTemplateActionType.REST: + if obj.action_type == AlertTemplateActionType.REST and obj.action_rest: return obj.action_rest.name - return obj.action.name + return obj.action.name if obj.action else "" def get_resolved_action_name(self, obj): - if obj.resolved_action_type == AlertTemplateActionType.REST: + if ( + obj.resolved_action_type == AlertTemplateActionType.REST + and obj.resolved_action_rest + ): return obj.resolved_action_rest.name - return obj.resolved_action.name + return obj.resolved_action.name if obj.resolved_action else "" def get_applied_count(self, instance): return (