app/dao/swimmer_presence_dao.rb
# Create a CSV file (; delimited) with swimmer presence data
#

Create a CSV file (; delimited) with swimmer presence data
Create a CSV file ( ; delimited ) with swimmer presence data
def to_csv( csv_file_name = 'SwimmerPresence_' + @swimmer_id.to_s )
    done = false
    if @meetings.size > 0
      rows = []
      File.open( csv_file_name + '.csv', 'w' ) do |f|
        file_titles = []
        file_titles << 'complete_name'
        file_titles << 'season_type'
        file_titles << 'meeting_date'
        file_titles << 'meeting_name'
        file_titles << 'events_count'
        file_titles << 'relays_count'
        file_titles << 'meeting_fee'
        file_titles << 'events_fee'
        file_titles << 'relays_fee'
        file_titles << 'total_fee'
        rows << file_titles.join(';')
        @meetings.each do |mpDAO| 
          file_row = []
          file_row << mpDAO.complete_name
          file_row << mpDAO.season_name
          file_row << mpDAO.header_date
          file_row << mpDAO.description
          file_row << mpDAO.events_count
          file_row << mpDAO.relays_count
          file_row << mpDAO.meeting_fee
          file_row << mpDAO.events_fee
          file_row << mpDAO.relays_fee
          file_row << mpDAO.total_fee
          rows << file_row.join(';')
        end
        f.puts rows.map{ |row| row }
      end
      done = true
    end
    done
  end
def to_csv ( csv_file_name = 'SwimmerPresence_' + @swimmer_id . to_s ) done = false if @meetings . size > 0 rows = [ ] File . open ( csv_file_name + '.csv' , 'w' ) do | f | file_titles = [ ] file_titles << 'complete_name' file_titles << 'season_type' file_titles << 'meeting_date' file_titles << 'meeting_name' file_titles << 'events_count' file_titles << 'relays_count' file_titles << 'meeting_fee' file_titles << 'events_fee' file_titles << 'relays_fee' file_titles << 'total_fee' rows << file_titles . join ( ';' ) @meetings . each do | mpDAO | file_row = [ ] file_row << mpDAO . complete_name file_row << mpDAO . season_name file_row << mpDAO . header_date file_row << mpDAO . description file_row << mpDAO . events_count file_row << mpDAO . relays_count file_row << mpDAO . meeting_fee file_row << mpDAO . events_fee file_row << mpDAO . relays_fee file_row << mpDAO . total_fee rows << file_row . join ( ';' ) end f . puts rows . map { | row | row } end done = true end done end
Create a CSV file (; delimited) with swimmer presence data
Create a CSV file ( ; delimited ) with swimmer presence data
# Check if at least one meeting present
 # Define file column headers

csv_file_name
<not_specific>
to_s
<not_specific>