app/strategies/meeting_reservation_updater.rb
# Creates a new detail row given the parameters.
# This method updates also the internal SQL diff log file.
#
# == Returns:
#
# The specified MeetingEventReservation or MeetingRelayReservation instance,
# depending upon the type of the +event_id+.
# Returns +nil+ only in case of no-operations.
#
Creates a new detail row given the parameters.
This method updates also the internal SQL diff log file.



The specified MeetingEventReservation or MeetingRelayReservation instance,
depending upon the type of the +event_id+.
Returns +nil+ only in case of no-operations.
Creates a new detail row given the parameters . This method updates also the internal SQL diff log file . The specified MeetingEventReservation or MeetingRelayReservation instance depending upon the type of the + event_id + . Returns + nil + only in case of no - operations .
def create_new_detail_row!( meeting_id, badge, event, is_doing_this, suggested_timing = nil,
                              notes = nil )
    return nil unless meeting_id.present? && badge.instance_of?(Badge) && event.instance_of?(MeetingEvent)
    mres = if event.event_type.is_a_relay?
      MeetingRelayReservation.new(
        meeting_id:         meeting_id,
        team_id:            badge.team_id,
        swimmer_id:         badge.swimmer_id,
        badge_id:           badge.id,
        meeting_event_id:   event.id,
        is_doing_this:      is_doing_this,
        notes:              notes,
        user_id:            @current_user.id
      )
    else
      MeetingEventReservation.new(
        meeting_id:         meeting_id,
        team_id:            badge.team_id,
        swimmer_id:         badge.swimmer_id,
        badge_id:           badge.id,
        meeting_event_id:   event.id,
        is_doing_this:      is_doing_this,
        suggested_minutes:  suggested_timing ? suggested_timing.minutes : nil,
        suggested_seconds:  suggested_timing ? suggested_timing.seconds : nil,
        suggested_hundreds: suggested_timing ? suggested_timing.hundreds : nil,
        user_id:            @current_user.id
      )
    end
    mres.save!
    sql_diff_text_log << to_sql_insert( mres, false, "\r\n" )
    mres
  end
def create_new_detail_row! ( meeting_id , badge , event , is_doing_this , suggested_timing = nil , notes = nil ) return nil unless meeting_id . present? && badge . instance_of? ( Badge ) && event . instance_of? ( MeetingEvent ) mres = if event . event_type . is_a_relay? MeetingRelayReservation . new ( meeting_id : meeting_id , team_id : badge . team_id , swimmer_id : badge . swimmer_id , badge_id : badge . id , meeting_event_id : event . id , is_doing_this : is_doing_this , notes : notes , user_id : @current_user . id ) else MeetingEventReservation . new ( meeting_id : meeting_id , team_id : badge . team_id , swimmer_id : badge . swimmer_id , badge_id : badge . id , meeting_event_id : event . id , is_doing_this : is_doing_this , suggested_minutes : suggested_timing ? suggested_timing . minutes : nil , suggested_seconds : suggested_timing ? suggested_timing . seconds : nil , suggested_hundreds : suggested_timing ? suggested_timing . hundreds : nil , user_id : @current_user . id ) end mres . save! sql_diff_text_log << to_sql_insert ( mres , false , "\r\n" ) mres end
Creates a new detail row given the parameters.
Creates a new detail row given the parameters .
# DEBUG #    puts "\r\ncreate_new_detail_row!( meeting_id: #{ meeting_id }, badge: #{ badge.id }, event: #{ event.get_full_name }, is_doing_this: #{ is_doing_this }, timing: #{ suggested_timing }, notes: '#{ notes }')" #    puts "before CREATE (detail)" # DEBUG #      puts "new RELAY res" # DEBUG #      puts "new EVENT res" # DEBUG #    puts "before Res (detail) SAVE!" #    puts ValidationErrorTools.recursive_error_for( mres ) unless mres.valid? # Store Db-diff text for INSERT
meeting_id
<not_specific>
badge
<not_specific>
event
<not_specific>
is_doing_this
<not_specific>
suggested_timing
<not_specific>
notes
<not_specific>