Added cached_votes_total and cached_votes_down to Legislation Proposals

This commit is contained in:
María Checa
2017-10-25 16:42:24 +02:00
parent 231a14c428
commit b5f2f9aa21
3 changed files with 18 additions and 2 deletions

View File

@@ -80,10 +80,18 @@ class Legislation::Proposal < ActiveRecord::Base
/\A#{Setting["proposal_code_prefix"]}-\d\d\d\d-\d\d-(\d*)\z/.match(terms)
end
def total_votes
def likes
cached_votes_up
end
def dislikes
cached_votes_down
end
def total_votes
cached_votes_total
end
def voters
User.active.where(id: votes_for.voters)
end