sportdb-models/lib/sportdb/csv_reader.rb
def handle_round( round_pos_str )

    round_pos = round_pos_str.to_i

    round_attribs = { }

    round = Round.find_by( event_id: @event.id,
                           pos:      round_pos )

    if round.present?
      logger.debug "update round #{round.id}:"
    else
      logger.debug "create round:"
      round = Round.new
          
      round_attribs = round_attribs.merge( {
        event_id: @event.id,
        pos:      round_pos,
        title:    "Round #{round_pos}",
        title2:   nil,
        knockout: false,
        start_at: Date.parse('1911-11-11'),
        end_at:   Date.parse('1911-11-11')
      })
    end

    logger.debug round_attribs.to_json
   
    round.update_attributes!( round_attribs )

    ### store list of round ids for patching start_at/end_at at the end
    @patch_round_ids << round.id
    @last_round = round     ## keep track of last seen round for matches that follow etc.
  end
def handle_round( round_pos_str )

    round_pos = round_pos_str.to_i

    round_attribs = { }

    round = Round.find_by( event_id: @event.id,
                           pos:      round_pos )

    if round.present?
      logger.debug "update round #{round.id}:"
    else
      logger.debug "create round:"
      round = Round.new
          
      round_attribs = round_attribs.merge( {
        event_id: @event.id,
        pos:      round_pos,
        title:    "Round #{round_pos}",
        title2:   nil,
        knockout: false,
        start_at: Date.parse('1911-11-11'),
        end_at:   Date.parse('1911-11-11')
      })
    end

    logger.debug round_attribs.to_json
   
    round.update_attributes!( round_attribs )

    ### store list of round ids for patching start_at/end_at at the end
    @patch_round_ids << round.id
    @last_round = round     ## keep track of last seen round for matches that follow etc.
  end
method load_fixtures