Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-13 21:20:48 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2015-11-16 16:07:38 +0300
commit986695e136a8f6afa326048b30be77a9265d3bf7 (patch)
tree390e60bd0213b3c431094cfe71395be845b77714 /app/finders
parent05335a3c8584c48a9317bd0919eccee6948de742 (diff)
Refactor global and group milestones logic
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/finders')
-rw-r--r--app/finders/milestones_finder.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/app/finders/milestones_finder.rb b/app/finders/milestones_finder.rb
new file mode 100644
index 00000000000..71f207ca030
--- /dev/null
+++ b/app/finders/milestones_finder.rb
@@ -0,0 +1,13 @@
+class MilestonesFinder
+ def execute(projects, params)
+ milestones = Milestone.of_projects(projects)
+ milestones = milestones.order("due_date ASC")
+
+ case params[:state]
+ when 'closed' then milestones.closed
+ when 'all' then milestones
+ else milestones.active
+ end
+ end
+end
+