diff options
author | Alfredo Sumaran <alfredo@gitlab.com> | 2016-08-24 12:29:27 -0500 |
---|---|---|
committer | Alfredo Sumaran <alfredo@gitlab.com> | 2016-09-07 15:27:14 -0500 |
commit | 8499de19c9bca4c43378b8a9cf2b6705f9cab647 (patch) | |
tree | e22d78a3b9ed7077e8c24f0bd72c4c08673af9ce /app | |
parent | 19e2bf1c21a853e45db0c18133e5f1b1234ad09f (diff) | |
download | gitlab-ce-8499de19c9bca4c43378b8a9cf2b6705f9cab647.tar.gz |
Ensure milestone counts work with no datagitlab-ce-milestone-tab-badges
Commit originally written by @smcgivern
Diffstat (limited to 'app')
-rw-r--r-- | app/helpers/milestones_helper.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/helpers/milestones_helper.rb b/app/helpers/milestones_helper.rb index b91f09f76ee..a11c313a6b8 100644 --- a/app/helpers/milestones_helper.rb +++ b/app/helpers/milestones_helper.rb @@ -36,14 +36,15 @@ module MilestonesHelper end # Returns count of milestones for different states - # Uses explicit hash keys as the 'opened' state URL params differs from the db value + # 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(milestones) counts = milestones.reorder(nil).group(:state).count + { - opened: counts['active'], - closed: counts['closed'], - all: counts.values.sum + opened: counts['active'] || 0, + closed: counts['closed'] || 0, + all: counts.values.sum || 0 } end |