+ return total_per_interval, labels_hash, interval_type
+ end
+
+ def get_borda_points(result)
+ #points holds how mnay points each candidate has received in array form
+ #becasue Gruff::Bar#data takes only an array
+ points = Array.new
+ labels = Hash.new
+
+ #Populate points with an sorted array from election.votes hash
+ #biggest to smallest will go from left to right
+ points = result.election.votes.sort do |a, b|
+ b[1] <=> a[1]
+ end.collect {|i| i[1]}
+
+ #make the labels
+ result.ranked_candidates.each_with_index do |candidate, index|
+ labels[index] = Candidate.find(candidate).name
+ end
+
+ return points, labels
+ end
+
+ #most vote result objects require an array of vote arrays, which this will make
+ def make_preference_tally(election)
+ preference_tally = Array.new
+ @election.voters.each do |voter|
+ next unless voter.voted?
+ preference_tally << voter.vote.rankings.sort.collect \
+ { |ranking| ranking.candidate.id }
+ end
+ return preference_tally