[#42] some refactoring

This commit is contained in:
Alexander Machehin 2013-04-18 00:28:50 +06:00
parent 03e2057a5a
commit db89e39bf5
1 changed files with 3 additions and 3 deletions

View File

@ -27,7 +27,7 @@ class Api::V1::IssuesController < Api::V1::BaseController
end end
def group_index def group_index
project_ids = @group.projects.pluck(:id).uniq project_ids = @group.projects.uniq.pluck(:id)
@issues = Issue.where(:project_id => project_ids) @issues = Issue.where(:project_id => project_ids)
render_issues_list render_issues_list
end end
@ -101,8 +101,8 @@ class Api::V1::IssuesController < Api::V1::BaseController
if ['created', 'all'].include? params[:filter] if ['created', 'all'].include? params[:filter]
# add own issues # add own issues
project_ids = Project.accessible_by(current_ability, :show).joins(:issues). project_ids = Project.accessible_by(current_ability, :show).joins(:issues).
where(:issues => {:user_id => current_user.id}).pluck('projects.id').uniq where(:issues => {:user_id => current_user.id}).uniq.pluck('projects.id')
end end
project_ids |= default_projects.pluck(:id).uniq project_ids |= default_projects.uniq.pluck(:id)
end end
end end