Avoid float conversion when calculating progress
This commit is contained in:
parent
5043d26cc5
commit
1862534b2c
2 changed files with 4 additions and 6 deletions
|
|
@ -211,7 +211,7 @@ class Event < ActiveRecord::Base
|
|||
def calculate_progress
|
||||
result = self.progress_status
|
||||
true_items = result.select { |_key, value| value }.length
|
||||
(true_items / result.length.to_f * 100).round(0).to_s
|
||||
(100 * true_items / result.length).to_s
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue