diff options
author | elijah <elijah@riseup.net> | 2015-06-09 14:59:57 -0700 |
---|---|---|
committer | elijah <elijah@riseup.net> | 2015-06-09 14:59:57 -0700 |
commit | 3b7fa50318ec8ebad77083ca4cb2188177942b47 (patch) | |
tree | 4e29eade4115d93ac1ede4f4890d7e372acdd908 /app/helpers | |
parent | 79d0f9b58bde08d3bc16ff143e2d1adba7b83e17 (diff) |
fix bug when budgeted cost had currency
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/version_reports_helper.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/app/helpers/version_reports_helper.rb b/app/helpers/version_reports_helper.rb index 930ac3d..71b4f3f 100644 --- a/app/helpers/version_reports_helper.rb +++ b/app/helpers/version_reports_helper.rb @@ -54,7 +54,7 @@ module VersionReportsHelper def hour_budget_error(issue) return unless @show_time || @show_money time_budget = (custom_field_value(issue, :hours) || 0).to_i - money_budget = (custom_field_value(issue, :money) || 0).to_i + money_budget = to_float(custom_field_value(issue, :money)||0).round if time_budget != 0 if issue.total_spent_hours.round != time_budget if issue.total_spent_hours < time_budget @@ -116,7 +116,11 @@ module VersionReportsHelper # drops currency in a string. def to_float(string) - string.gsub(/[^0-9\.]/, '').to_f + if string.is_a? String + string.gsub(/[^0-9\.]/, '').to_f + else + string.to_f + end end end |