added unique filter to categories

This commit is contained in:
Harry Bomrah 2015-09-24 16:55:51 +08:00
parent 46df9d3954
commit 87b382bf3a
1 changed files with 1 additions and 0 deletions

View File

@ -19,6 +19,7 @@ class Admin::TicketsController < OrbitAdminController
else else
@categories = authorizations.collect{|authorization| authorization.category} @categories = authorizations.collect{|authorization| authorization.category}
@categories.delete(nil) @categories.delete(nil)
@categories.uniq!
@categories.each do |category| @categories.each do |category|
temp = Ticket.where(:category_id => category.id).open.not_urgent.limit(5).asc(:created_at) temp = Ticket.where(:category_id => category.id).open.not_urgent.limit(5).asc(:created_at)
@tickets[category] = temp if temp.count > 0 @tickets[category] = temp if temp.count > 0