Remove monkey-patch of the Numeric class
This monkey-patch doesn't seem to be working with Zeitwerk, and we were only using it in one place, so the easiest way to solve the problem is to remove it. Note that, in the process, we're changing the operation so `* 100` appears before the division, so it's consistent with other places where we do similar things (like the `supports_percentage` method in the proposals helper).
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
module VotesHelper
|
||||
def debate_percentage_of_likes(debate)
|
||||
debate.likes.percent_of(debate.total_votes)
|
||||
(debate.likes.to_f * 100 / debate.total_votes).to_i
|
||||
end
|
||||
|
||||
def votes_percentage(vote, debate)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
require "numeric"
|
||||
|
||||
class Debate < ApplicationRecord
|
||||
include Flaggable
|
||||
include Taggable
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
class Numeric
|
||||
def percent_of(n)
|
||||
(to_f / n * 100).to_i
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user