Commits list renders the wrong number of commits-per-day
First mentioned by @cynthia in https://gitlab.slack.com/archives/CETG54GQ0/p1587751503489200
For example, on https://gitlab.com/gitlab-org/release-tools/commits/master, it always shows 40 commits per day:
This was introduced in !29306 (merged):
- commits_count = @commits.size
- commits.chunk { |c| c.committed_date.in_time_zone.to_date }.each do |day, commits|
%li.commit-header.js-commit-header{ data: { day: day } }
%span.day= l(day, format: '%d %b, %Y')
%span.commits-count= n_("%d commit", "%d commits", commits_count) % commits_count
We set commits_count
to @commits.size
at the top-level, and then re-use that count in the chunk
block, so every chunk will show the total size of the commits.
The variable is used again at the bottom to render an empty message:
- if commits_count == 0
.mt-4.text-center
.bold
= _('Your search didn\'t match any commits.')
= _('Try changing or removing filters.')
That message is mutually exclusive to the chunked list, it should be an if/else
I would think.
When fixing we need to make sure we don't undo the optimization from @stanhu in 5138d659.