summaryrefslogtreecommitdiff
path: root/app/models/group_milestone.rb
diff options
context:
space:
mode:
authorMarin Jankovski <marin@gitlab.com>2014-06-26 11:58:40 +0200
committerMarin Jankovski <marin@gitlab.com>2014-06-30 09:44:30 +0200
commit4ca8a175a2695dd2fc28084253a4471bad30bf00 (patch)
treeca4ac77b34da9e2351f355fe44c11ef8af03d951 /app/models/group_milestone.rb
parent0723bf1afaaf13ddcb58c211161389052d18e501 (diff)
downloadgitlab-ce-4ca8a175a2695dd2fc28084253a4471bad30bf00.tar.gz
Filter group milestones.
Diffstat (limited to 'app/models/group_milestone.rb')
-rw-r--r--app/models/group_milestone.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/app/models/group_milestone.rb b/app/models/group_milestone.rb
index c2fb3a5edee..132c0eb2497 100644
--- a/app/models/group_milestone.rb
+++ b/app/models/group_milestone.rb
@@ -38,4 +38,13 @@ class GroupMilestone
rescue ZeroDivisionError
100
end
+
+ def state
+ state = milestones.map{ |milestone| milestone.state }
+ if state.all?{ |milestone_state| milestone_state == 'active' }
+ 'active'
+ else
+ 'closed'
+ end
+ end
end