Permalink
Browse files

fix athlete qualification logic and change sort to qualify, then total

  • Loading branch information...
1 parent a3cd5dc commit 8d962eacef11dec61cc05ac4b02f80ed4005ec90 @mikepmunroe committed Apr 9, 2013
Showing with 5 additions and 7 deletions.
  1. +1 −1 app/controllers/southie_controller.rb
  2. +1 −1 app/controllers/wicked_controller.rb
  3. +3 −5 app/models/athlete.rb
@@ -1,6 +1,6 @@
class SouthieController < ApplicationController
def index
- athletes = Athlete.where(:affiliate => 'southie').order('total asc')
+ athletes = Athlete.where(:affiliate => 'southie').order('qualified desc, total asc')
male_athletes = athletes.where(:gender => 'Male')
female_athletes = athletes.where(:gender => 'Female')
@individual_men = male_athletes.where('age < 40')
@@ -1,6 +1,6 @@
class WickedController < ApplicationController
def index
- athletes = Athlete.where(:affiliate => 'wicked').order('qualified asc')
+ athletes = Athlete.where(:affiliate => 'wicked').order('qualified desc, total asc')
male_athletes = athletes.where(:gender => 'Male')
female_athletes = athletes.where(:gender => 'Female')
@individual_men = male_athletes.where('age < 40')
@@ -69,11 +69,9 @@ def self.qualify
scores.each do |value|
puts value
if (match = value.match(/\A\d/))
- if (match)
- athlete.qualified = true
- else
- athlete.qualified = false
- end
+ athlete.qualified = true
+ else
+ athlete.qualified = false
end
end
athlete.save

0 comments on commit 8d962ea

Please sign in to comment.