X-Git-Url: https://projects.mako.cc/source/selectricity-live/blobdiff_plain/b47d1fbe36d5aeb9b79d6bbaab035ca448a3c3ef..adfcf4dd7d989d0560e2a8f6a590dd10c5a49a08:/app/models/vote.rb diff --git a/app/models/vote.rb b/app/models/vote.rb index bb91a6b..bef3502 100644 --- a/app/models/vote.rb +++ b/app/models/vote.rb @@ -69,13 +69,9 @@ class Vote < ActiveRecord::Base rankings.each { |ranking| ranking.destroy } end - def settime - self.time = Time.now - self.save - end - def confirm! self.confirmed = 1 + self.time = Time.now self.save unless self.voter.election.quickvote? @@ -105,7 +101,7 @@ class Vote < ActiveRecord::Base # too. It creates a vote with the candidates listed in order of preference # based on alphabetical order. Meant to be manipulated and then confirmed def set_defaults! - self.votes = voter.election.candidates.sort.collect {|c| c.id } + self.votes = self.voter.election.candidates.sort_by { rand }.collect {|c| c.id } self.save end