app/controllers/misc_controller.rb
# #AJAX POST-only swimmer_matches
#
# Find out and show swimmer matches
#
AJAX POST-only swimmer_matches
Find out and show swimmer matches
AJAX POST - only swimmer_matches Find out and show swimmer matches
def show_swimmer_matches
    if request.xhr? && request.post?                   
      local_swimmer_id  = params['local_swimmer'] ? params['local_swimmer']['id'].to_i : 0
      visitor_swimmer_id = params['visitor_swimmer'] ? params['visitor_swimmer']['id'].to_i : 0
      unless ( local_swimmer_id > 0 && visitor_swimmer_id > 0 && Swimmer.exists?( local_swimmer_id ) && Swimmer.exists?( visitor_swimmer_id ) )
        flash[:error] = I18n.t(:missing_request_parameter)
        return
      end
      @local_swimmer  = Swimmer.find_by_id( local_swimmer_id )
      @visitor_swimmer = Swimmer.find_by_id( visitor_swimmer_id )
      @sme = SwimmerMatchEvaluator.new( @local_swimmer )
      @sme_dao = @sme.matches_to_dao if @sme.set_visitor( @visitor_swimmer )
    end
  end
def show_swimmer_matches if request . xhr? && request . post? local_swimmer_id = params [ 'local_swimmer' ] ? params [ 'local_swimmer' ] [ 'id' ] . to_i : 0 visitor_swimmer_id = params [ 'visitor_swimmer' ] ? params [ 'visitor_swimmer' ] [ 'id' ] . to_i : 0 unless ( local_swimmer_id > 0 && visitor_swimmer_id > 0 && Swimmer . exists? ( local_swimmer_id ) && Swimmer . exists? ( visitor_swimmer_id ) ) flash [ :error ] = I18n . t ( :missing_request_parameter ) return end @local_swimmer = Swimmer . find_by_id ( local_swimmer_id ) @visitor_swimmer = Swimmer . find_by_id ( visitor_swimmer_id ) @sme = SwimmerMatchEvaluator . new ( @local_swimmer ) @sme_dao = @sme . matches_to_dao if @sme . set_visitor ( @visitor_swimmer ) end end
AJAX POST-only swimmer_matches
Find out and show swimmer matches
AJAX POST - only swimmer_matches Find out and show swimmer matches
# DEBUG #    puts "\r\n*********** show_swimmer_matches ***********" #    puts params.inspect # === AJAX POST: === #local_swimmer_id  = 23 #visitor_swimmer_id = 142 #puts "\r\n- SME (before visitor set): " << @sme.inspect #puts "\r\n- SME (AFTER visitor set): " << @sme.inspect