Skip to content
Snippets Groups Projects
Commit 76db0dc1 authored by Ahmad Sherif's avatar Ahmad Sherif
Browse files

Pass project IDs relation to ProjectsFinder instead of using a block

parent d13c36f7
No related branches found
No related tags found
No related merge requests found
class ProjectsFinder < UnionFinder
def execute(current_user = nil, options = {}, &block)
def execute(current_user = nil, project_ids_relation = nil)
segments = all_projects(current_user)
segments.map!(&block) if block
segments.map! { |s| s.where(id: project_ids_relation) } if project_ids_relation
 
find_union(segments, Project)
end
Loading
Loading
Loading
Loading
@@ -95,9 +95,7 @@ class TodosFinder
 
def projects(items)
item_project_ids = items.reorder(nil).select(:project_id)
ProjectsFinder.new.execute(current_user) do |relation|
relation.where(id: item_project_ids)
end
ProjectsFinder.new.execute(current_user, item_project_ids)
end
 
def type?
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment