Bläddra i källkod

Bugfix. Check all candidacies have got votes for this poll.

tags/last-sinatra-version
Adrian Short 6 år sedan
förälder
incheckning
45cb023daf
1 ändrade filer med 1 tillägg och 3 borttagningar
  1. +1
    -3
      models.rb

+ 1
- 3
models.rb Visa fil

@@ -40,9 +40,7 @@ class Poll
# Returns array of candidacies, or false if we don't have results for this poll
def set_positions
# Check that every candidacy for this poll has its votes recorded (ie that the election results are known)
if Candidacy.count(:conditions => { :district_id => @district_id, :election_id => @election_id, :votes => nil }) == 0
return false
end
return false if Candidacy.count(:conditions => { :district_id => @district_id, :election_id => @election_id, :votes => nil }) > 0

# Get the candidacies for this poll
ccys = Candidacy.all(:conditions => { :district_id => @district_id, :election_id => @election_id }, :order => [:votes.desc])


Laddar…
Avbryt
Spara