From 83df555681174bd93f3a41cb9ce0e37d3cd1bc8c Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Fri, 4 Feb 2011 09:19:26 -0800 Subject: [PATCH] [#5416] Remove rounding in the Issue time spent, billable and overhead --- lib/overhead_issue_patch.rb | 7 ++----- spec/lib/overhead_issue_patch_spec.rb | 12 ++++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/lib/overhead_issue_patch.rb b/lib/overhead_issue_patch.rb index 37ace2c..64776de 100644 --- a/lib/overhead_issue_patch.rb +++ b/lib/overhead_issue_patch.rb @@ -24,11 +24,8 @@ module OverheadIssuePatch sum += time_entry.hours if time_entry.billable? == billable_flag sum } - if time > 0 - return time.round(1) - else - return 0 - end + return 0 if time <= 0 + return time end end diff --git a/spec/lib/overhead_issue_patch_spec.rb b/spec/lib/overhead_issue_patch_spec.rb index ecede72..e4189e9 100644 --- a/spec/lib/overhead_issue_patch_spec.rb +++ b/spec/lib/overhead_issue_patch_spec.rb @@ -25,13 +25,13 @@ describe Issue, '#billable_time_spent' do issue.billable_time_spent.should eql(25.0) end - it 'should round to the tenths place' do + it 'should not round' do time_entries = [mock_time_entry(20, true), - mock_time_entry(13.333333, true)] + mock_time_entry(13.333, true)] issue = Issue.new issue.should_receive(:time_entries).and_return(time_entries) - issue.billable_time_spent.should eql(33.3) + issue.billable_time_spent.should eql(33.333) end @@ -62,13 +62,13 @@ describe Issue, '#overhead_time_spent' do issue.overhead_time_spent.should eql(60.0) end - it 'should round to the tenths place' do + it 'should not round' do time_entries = [mock_time_entry(20, false), - mock_time_entry(13.333333, false)] + mock_time_entry(13.333, false)] issue = Issue.new issue.should_receive(:time_entries).and_return(time_entries) - issue.overhead_time_spent.should eql(33.3) + issue.overhead_time_spent.should eql(33.333) end