From 89be7a0fde3a7c612734bc890825c484173101de Mon Sep 17 00:00:00 2001 From: Timothy Hobbs Date: Wed, 27 Mar 2019 17:16:33 +0100 Subject: [PATCH] Don't show resolved tickets in unassigned tickets list Fixes #741 --- helpdesk/views/staff.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index b09d8cba..8e956de3 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -138,13 +138,15 @@ def dashboard(request): showing ticket counts by queue/status, and a list of unassigned tickets with options for them to 'Take' ownership of said tickets. """ - # open & reopened tickets, assigned to current user - tickets = Ticket.objects.select_related('queue').filter( - assigned_to=request.user, - ).exclude( + active_tickets = Ticket.objects.select_related('queue').exclude( status__in=[Ticket.CLOSED_STATUS, Ticket.RESOLVED_STATUS], ) + # open & reopened tickets, assigned to current user + tickets = active_tickets.filter( + assigned_to=request.user, + ) + # closed & resolved tickets, assigned to current user tickets_closed_resolved = Ticket.objects.select_related('queue').filter( assigned_to=request.user, @@ -152,11 +154,9 @@ def dashboard(request): user_queues = _get_user_queues(request.user) - unassigned_tickets = Ticket.objects.select_related('queue').filter( + unassigned_tickets = active_tickets.filter( assigned_to__isnull=True, queue__in=user_queues - ).exclude( - status=Ticket.CLOSED_STATUS, ) # all tickets, reported by current user