Expose the most and least number of conflicts

This commit is contained in:
Petko Bordjukov 2016-10-13 04:32:42 +03:00
parent b9e6a89f22
commit a8d05ea625
3 changed files with 16 additions and 1 deletions

View File

@ -1,2 +1,9 @@
class ConflictsForTalk < ApplicationRecord class ConflictsForTalk < ApplicationRecord
def self.most
first
end
def self.least
last
end
end end

View File

@ -9,6 +9,14 @@ class Summary
.uniq.count .uniq.count
end end
def most_conflicts
ConflictsForTalk.where(talk_id: talk_ids).most.conflicts
end
def least_conflicts
ConflictsForTalk.where(talk_id: talk_ids).least.conflicts
end
def ranking def ranking
@ranking ||= Ranking.new(talk_ids: talk_ids).ranking @ranking ||= Ranking.new(talk_ids: talk_ids).ranking
end end

View File

@ -1 +1 @@
json.extract! @summary, :number_of_ballots, :ranking json.extract! @summary, :number_of_ballots, :most_conflicts, :least_conflicts, :ranking