International-Aerobatic-Club / iaccdb

IAC Aerobatic Contest Database
iaccdb.iac.org
1 stars 1 forks source link

Soucy calculations ignore either the Power or Glider results from Nationals #245

Closed djmolny closed 1 year ago

djmolny commented 1 year ago

JaSPer has different operating modes for the Power vs Glider classes, and the two cannot be present in a single dataset. Because both classes are flown at Nationals, we will normally have two "Nationals" data files and two listings in IACCDB.

The rules for the Soucy trophy state: "The purpose of the award is to recognize the IAC competition pilot who achieves the highest percentage of points possible during a contest season and who also competes in three or more contests, one of which is the U.S. National Aerobatic Championships."

Here is the current code for the IAC::SoucyComputer.integrate_nationals method:

def integrate_nationals
  nationals = Contest.where("YEAR(start) = ? AND region = 'National'", @year).all
  if (nationals.size > 1)
    puts "MORE THAN ONE NATIONALS in #{@year}"
    nationals.each { |n| puts n.inspect }
  end
  nationals = nationals.first
  if nationals
    @soucies.each { |soucy| soucy.integrate_national_result(nationals) }
  end
end

The author clearly assumed that there would be only one "Nationals" contest listing and uses only the first contest that's returned by the query. As a result, only Power or Glider results are processed, when in fact both should be used.