Commit 635393b5 authored by msdundar's avatar msdundar

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

Closes #26512
parent 87f03f01
---
title: Show one digit after dot in commit_per_day value in charts page.
merge_request:
author: msdundar
type: changed
...@@ -18,7 +18,7 @@ module Gitlab ...@@ -18,7 +18,7 @@ module Gitlab
end end
def commit_per_day def commit_per_day
@commit_per_day ||= @commits.size / (@duration + 1) @commit_per_day ||= (@commits.size.to_f / (@duration + 1)).round(1)
end end
def collect_data def collect_data
......
...@@ -29,7 +29,7 @@ describe Gitlab::Graphs::Commits do ...@@ -29,7 +29,7 @@ describe Gitlab::Graphs::Commits do
context 'with commits from yesterday and today' do context 'with commits from yesterday and today' do
subject { described_class.new([commit2, commit1_yesterday]) } subject { described_class.new([commit2, commit1_yesterday]) }
describe '#commit_per_day' do 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 end
describe '#duration' do describe '#duration' do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment