gauge/app/models/summary.rb

16 lines
387 B
Ruby
Raw Normal View History

2016-10-10 21:28:23 +03:00
class Summary
include ActiveModel::Model
attr_accessor :talk_ids
def number_of_ballots
@number_of_ballots ||= TalkPreference.joins(:selected_talks)
.where(selected_talks: {talk_id: @talk_ids})
.uniq.count
end
def ranking
@ranking ||= Ranking.new(talk_ids: talk_ids).ranking
end
end