small mods for notification

This commit is contained in:
Harry Bomrah 2015-10-02 16:35:47 +08:00
parent 2256f04683
commit bdeb70c5fb
2 changed files with 10 additions and 5 deletions

View File

@ -50,15 +50,20 @@ class Admin::TicketsController < OrbitAdminController
end
def tagged_tickets
tqrs = TicketQueryResponse.where(:user_tags.in => [current_user.id.to_s], :read_by.nin => [current_user.id.to_s], :status.ne => "closed")
if params[:keywords].present?
statuses = ["open","commenced", "closed"]
else
statuses = ["open","commenced"]
end
tqrs = TicketQueryResponse.where(:user_tags.in => [current_user.id.to_s], :read_by.nin => [current_user.id.to_s])
@unread_tickets = []
@read_tickets = []
tqrs.each do |tqr|
@unread_tickets << tqr.ticket_query.ticket if !tqr.ticket_query.nil? && !tqr.ticket_query.ticket.nil?
@unread_tickets << tqr.ticket_query.ticket if !tqr.ticket_query.nil? && !tqr.ticket_query.ticket.nil? && statuses.include?(tqr.ticket_query.ticket.status)
end
tqrs = TicketQueryResponse.where(:user_tags.in => [current_user.id.to_s], :read_by.in => [current_user.id.to_s], :status.ne => "closed")
tqrs = TicketQueryResponse.where(:user_tags.in => [current_user.id.to_s], :read_by.in => [current_user.id.to_s])
tqrs.each do |tqr|
@read_tickets << tqr.ticket_query.ticket if !tqr.ticket_query.nil? && !tqr.ticket_query.ticket.nil?
@read_tickets << tqr.ticket_query.ticket if !tqr.ticket_query.nil? && !tqr.ticket_query.ticket.nil? && statuses.include?(tqr.ticket_query.ticket.status)
end
@read_tickets.uniq!
@unread_tickets.uniq!

View File

@ -50,7 +50,7 @@ class Ticket
tqrs = TicketQueryResponse.where(:user_tags.in => [user.id.to_s], :read_by.nin => [user.id.to_s])
unread_tickets = []
tqrs.each do |tqr|
unread_tickets << tqr.ticket_query.ticket if !tqr.ticket_query.nil? && !tqr.ticket_query.ticket.nil?
unread_tickets << tqr.ticket_query.ticket if !tqr.ticket_query.nil? && !tqr.ticket_query.ticket.nil? && tqr.ticket_query.ticket.status != "closed"
end
unread_tickets.uniq!
unread_tickets.count