app/controllers/records_controller.rb
# Collects individual records/best results for a specified Swimmer (but classified as 'generic').
#
# Dual-phase action:
# - Phase 1: GET => renders search form
# - Phase 2: XHR GET => renders AJAX grid with result, expects parameter:
#            - params[:swimmer][:id] => the swimmers.id for the filtering
#
Collects individual records/best results for a specified Swimmer (but classified as 'generic').
Collects individual records / best results for a specified Swimmer ( but classified as ' generic ' ) .
def for_swimmer
    if request.xhr? && params['swimmer'] && params['swimmer']['id']
      swimmer = Swimmer.find_by_id( params['swimmer']['id'] )
      collector = RecordCollector.new( swimmer: swimmer, record_type_code: 'FOR' )
      collector.full_scan do |this, pool_code, event_code, category_code, gender_code|
        this.collect_from_results_having( pool_code, event_code, category_code, gender_code, 'FOR' )
      end if swimmer
      @title = swimmer ? "#{ I18n.t('records.swimmer_title') } (#{swimmer.get_full_name})" : I18n.t('records.swimmer_title')
      @grid_builder = RecordGridBuilder.new( collector, 'FOR' )
    else
      @title = I18n.t('records.swimmer_search_title')
    end
    respond_to do |format|
      format.html
      format.js
    end
  end
def for_swimmer if request . xhr? && params [ 'swimmer' ] && params [ 'swimmer' ] [ 'id' ] swimmer = Swimmer . find_by_id ( params [ 'swimmer' ] [ 'id' ] ) collector = RecordCollector . new ( swimmer : swimmer , record_type_code : 'FOR' ) collector . full_scan do | this , pool_code , event_code , category_code , gender_code | this . collect_from_results_having ( pool_code , event_code , category_code , gender_code , 'FOR' ) end if swimmer @title = swimmer ? "#{ I18n.t('records.swimmer_title') } (#{swimmer.get_full_name})" : I18n . t ( 'records.swimmer_title' ) @grid_builder = RecordGridBuilder . new ( collector , 'FOR' ) else @title = I18n . t ( 'records.swimmer_search_title' ) end respond_to do | format | format . html format . js end end
Collects individual records/best results for a specified Swimmer (but classified as 'generic').
Collects individual records / best results for a specified Swimmer ( but classified as ' generic ' ) .
# DEBUG #    logger.debug "\r\n\r\n!! ------ #{self.class.name} -----" #    logger.debug "> #{params.inspect}" #    logger.debug "> #{request.inspect}\r\n\r\n=====================================================\r\n\r\n" # AJAX call? Parse parameter and retrieve records range: # Respond according to requested format (GET request => .html, AJAX request => .js)