Skip to content

Commit

Permalink
return empty list in tag percentage view
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisoSouza committed Dec 12, 2024
1 parent 4b5b936 commit 578ae32
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nexus/logs/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def count_status(logs, tag):
message_logs = message_logs.exclude(message__status="F")

if not message_logs.exists():
return Response({"error": "No logs found for the given date range"}, status=404)
return Response([], status=200)

tag_counts = message_logs.aggregate(action_count=Count(Case(When(reflection_data__tag='action_started', then=1), output_field=IntegerField())))

Expand All @@ -97,7 +97,7 @@ def count_status(logs, tag):

total_logs = sum(tag_counts.values())
if total_logs == 0:
return Response({"error": "No logs found for the given date range"}, status=404)
return Response([], status=200)

action_percentage = (tag_counts['action_count'] / total_logs) * 100
succeed_percentage = (tag_counts['succeed_count'] / total_logs) * 100
Expand Down

0 comments on commit 578ae32

Please sign in to comment.