app/dao/record_x4_dao.rb
# Adds a record to the record collection
#

Adds a record to the record collection
Adds a record to the record collection
def add_record( meeting_individual_result, category_type = nil, pool_type = nil, gender_type = nil, event_type = nil, swimmer = nil )
    added = false
    if meeting_individual_result && meeting_individual_result.instance_of?( MeetingIndividualResult )
      category_type = meeting_individual_result.category_type if !category_type
      pool_type = meeting_individual_result.pool_type if !pool_type
      gender_type = meeting_individual_result.gender_type if !gender_type
      event_type = meeting_individual_result.event_type if !event_type
      new_record = RecordElementDAO.new( pool_type, gender_type, event_type, category_type, meeting_individual_result, swimmer )
      if new_record
        record_code = new_record.get_record_code
        @records[record_code] = new_record 
        added = true
        @gender_types << gender_type if !@gender_types.include?( gender_type ) 
        @pool_types << pool_type if !@pool_types.include?( pool_type )
        table_code = gender_type.code + '-' + pool_type.code
        @category_types[table_code] = [] if @category_types[table_code].nil?
        @event_types[table_code] = [] if @event_types[table_code].nil?
        @category_types[table_code] << category_type if @category_types[table_code].rindex{ |e| e.code == category_type.code }.nil? 
        @event_types[table_code] << event_type if @event_types[table_code].rindex{ |e| e.code == event_type.code }.nil?
      end
    end
    added
  end
def add_record ( meeting_individual_result , category_type = nil , pool_type = nil , gender_type = nil , event_type = nil , swimmer = nil ) added = false if meeting_individual_result && meeting_individual_result . instance_of? ( MeetingIndividualResult ) category_type = meeting_individual_result . category_type if ! category_type pool_type = meeting_individual_result . pool_type if ! pool_type gender_type = meeting_individual_result . gender_type if ! gender_type event_type = meeting_individual_result . event_type if ! event_type new_record = RecordElementDAO . new ( pool_type , gender_type , event_type , category_type , meeting_individual_result , swimmer ) if new_record record_code = new_record . get_record_code @records [ record_code ] = new_record added = true @gender_types << gender_type if ! @gender_types . include? ( gender_type ) @pool_types << pool_type if ! @pool_types . include? ( pool_type ) table_code = gender_type . code + '-' + pool_type . code @category_types [ table_code ] = [ ] if @category_types [ table_code ] . nil? @event_types [ table_code ] = [ ] if @event_types [ table_code ] . nil? @category_types [ table_code ] << category_type if @category_types [ table_code ] . rindex { | e | e . code == category_type . code } . nil? @event_types [ table_code ] << event_type if @event_types [ table_code ] . rindex { | e | e . code == event_type . code } . nil? end end added end
Adds a record to the record collection
Adds a record to the record collection
# TODO Eventually manage scenarios with records already present
 # - Should be an error (consider only the best)
 # - Should be a pair (same time swam in different results). In this case should review get methods too
 # Add record to the record ash
 # Populates member arrays

meeting_individual_result
<not_specific>
category_type
<not_specific>
pool_type
<not_specific>
gender_type
<not_specific>
event_type
<not_specific>
swimmer
<not_specific>