app/strategies/swimmer_presence_checker.rb
# Scan a season to find meeting with swimmer presence
# Returns numeber of attended meeting found
#
Scan a season to find meeting with swimmer presence
Returns numeber of attended meeting found
Scan a season to find meeting with swimmer presence Returns numeber of attended meeting found
def scan_season( season, individual_costs = false, relay_costs = false, check_date = Date.today() )
    season.meetings.where(['meetings.are_results_acquired or meetings.header_date < ? or (meetings.entry_deadline is not null and meetings.entry_deadline < ?)', check_date, check_date] ).each do |meeting|
      if has_swimmer_attended_meeting?( meeting )
        mp = SwimmerPresenceDAO::MeetingPresenceDAO.new( meeting, season, individual_costs, relay_costs )
        mp.det_reservations_count = count_swimmer_reservations( meeting )
        mp.det_entries_count = count_swimmer_entries( meeting )
        mp.det_results_count = count_swimmer_mirs( meeting )
        mp.was_present = (mp.det_results_count > 0)
        mp.events_count = [mp.det_reservations_count, mp.det_entries_count, mp.det_results_count].max  
        mp.relays_count = count_swimmer_relays( meeting )
        @swimmer_presence_dao.add_meeting( mp )
      end
    end
    @swimmer_presence_dao.meetings.count
  end
def scan_season ( season , individual_costs = false , relay_costs = false , check_date = Date . today ( ) ) season . meetings . where ( [ 'meetings.are_results_acquired or meetings.header_date < ? or (meetings.entry_deadline is not null and meetings.entry_deadline < ?)' , check_date , check_date ] ) . each do | meeting | if has_swimmer_attended_meeting? ( meeting ) mp = SwimmerPresenceDAO :: MeetingPresenceDAO . new ( meeting , season , individual_costs , relay_costs ) mp . det_reservations_count = count_swimmer_reservations ( meeting ) mp . det_entries_count = count_swimmer_entries ( meeting ) mp . det_results_count = count_swimmer_mirs ( meeting ) mp . was_present = ( mp . det_results_count > 0 ) mp . events_count = [ mp . det_reservations_count , mp . det_entries_count , mp . det_results_count ] . max mp . relays_count = count_swimmer_relays ( meeting ) @swimmer_presence_dao . add_meeting ( mp ) end end @swimmer_presence_dao . meetings . count end
Scan a season to find meeting with swimmer presence
Returns numeber of attended meeting found
Scan a season to find meeting with swimmer presence Returns numeber of attended meeting found
#season.meetings.has_results.each do |meeting| # Maybe better move logic to DAO
season
<not_specific>
individual_costs
<not_specific>
relay_costs
<not_specific>
check_date
<not_specific>
today
<not_specific>