def manager_closed_ticket(request, structure_slug, structure): """ Returns all closed tickets managed by manager :type structure_slug: String :type structure: OrganizationalStructure (from @is_manager) :param structure_slug: manager structure slug :param structure: manager structure (from @is_manager) :return: JsonResponse """ tickets = TicketAssignment.get_ticket_per_structure(structure=structure) ticket_list = Ticket.objects.filter(code__in=tickets, is_closed=True) dtd = TicketDTD(request, ticket_list, _ticket_columns) return JsonResponse(dtd.get_dict())
def manager_my_opened_ticket(request, structure_slug, structure): """ Returns all assigned and not closed tickets taken by manager :type structure_slug: String :type structure: OrganizationalStructure (from @is_manager) :param structure_slug: manager structure slug :param structure: manager structure (from @is_manager) :return: JsonResponse """ tickets = TicketAssignment.get_ticket_per_structure(structure=structure) ticket_list = Ticket.objects.filter(code__in=tickets, is_closed=False) result_list = copy.deepcopy(ticket_list) for ticket in ticket_list: if not ticket.has_been_taken(structure=structure, user=request.user): result_list = result_list.exclude(pk=ticket.pk) dtd = TicketDTD(request, result_list, _ticket_columns) return JsonResponse(dtd.get_dict())
def ticket_in_category(category): result = 0 office = category.organizational_office tickets = TicketAssignment.get_ticket_in_office_list(office_list=[office,]) return len(tickets)