diff options
author | Dan Rowden <hello@danrowden.com> | 2016-07-26 00:23:27 +0300 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-09-07 23:27:14 +0300 |
commit | da7c14442cc97e1ecd4c34ab2ef9bf2662ea241d (patch) | |
tree | 8a4ac4a1de59de10e9b1721a9399a10d992529c8 /app/helpers/milestones_helper.rb | |
parent | c1f508b0b10965f9827a9e6bd564e9c0fd00f595 (diff) |
Updated milestone count helper plus tests
Diffstat (limited to 'app/helpers/milestones_helper.rb')
-rw-r--r-- | app/helpers/milestones_helper.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index 22d8ecd3ecb..404a116d951 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -38,12 +38,12 @@ module MilestonesHelper # Returns count of milestones for different states # Uses explicit hash keys as the 'opened' state URL params differs from the db value # and we need to add the total - def milestone_counts(project:) - counts = @project.milestones.reorder(nil).group(:state).count() + def milestone_counts(milestones) + counts = milestones.reorder(nil).group(:state).count { opened: counts['active'], closed: counts['closed'], - all: counts['active'] + counts['closed'] + all: counts.values.sum } end |