Show one digit after dot in commit_per_day value in charts page.

Closes #26512
This commit is contained in:
msdundar 2018-07-30 03:37:47 +03:00
parent 87f03f0173
commit 635393b50b
3 changed files with 7 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
title: Show one digit after dot in commit_per_day value in charts page.
merge_request:
author: msdundar
type: changed

View File

@ -18,7 +18,7 @@ module Gitlab
end
def commit_per_day
@commit_per_day ||= @commits.size / (@duration + 1)
@commit_per_day ||= (@commits.size.to_f / (@duration + 1)).round(1)
end
def collect_data

View File

@ -29,7 +29,7 @@ describe Gitlab::Graphs::Commits do
context 'with commits from yesterday and today' do
subject { described_class.new([commit2, commit1_yesterday]) }
describe '#commit_per_day' do
it { expect(subject.commit_per_day).to eq 1 }
it { expect(subject.commit_per_day).to eq 0.7 }
end
describe '#duration' do