removes empty % sign when there are no votes
This commit is contained in:
@@ -4,4 +4,8 @@ module ApplicationHelper
|
||||
debate.tag_list.map { |tag| link_to sanitize(tag), debates_path(tag: tag) }.join(', ').html_safe
|
||||
end
|
||||
|
||||
def percentage(vote, debate)
|
||||
return if debate.total_votes == 0
|
||||
debate.send(vote).percent_of(debate.total_votes).to_s + "%"
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user