app/strategies/relay_swimmer_updater.rb
# Edits an existing row id assuming its new timing value is specified as
# an incremental timing (as a string).
#
# This method updates also the internal SQL diff log file.
#
# == Returns:
#
# The specified MeetingRelaySwimmer instance (which will result updated only when successful).
# nil only in case of no-ops.
#
Edits an existing row id assuming its new timing value is specified as
an incremental timing (as a string).

This method updates also the internal SQL diff log file.



The specified MeetingRelaySwimmer instance (which will result updated only when successful).
nil only in case of no-ops.
Edits an existing row id assuming its new timing value is specified as an incremental timing ( as a string ) . This method updates also the internal SQL diff log file . The specified MeetingRelaySwimmer instance ( which will result updated only when successful ) . nil only in case of no - ops .
def edit_existing_row!( mrs, swimmer_id, badge_id, stroke_type_id, timing_instance, reaction_time_instance )
    return nil unless swimmer_id.present? && badge_id.present?
    if is_an_actual_update_of( mrs, swimmer_id, badge_id, timing_instance, reaction_time_instance )
      mrs.update!(
        swimmer_id:     swimmer_id,
        badge_id:       badge_id,
        minutes:        timing_instance ? timing_instance.minutes : 0,
        seconds:        timing_instance ? timing_instance.seconds : 0,
        hundreds:       timing_instance ? timing_instance.hundreds : 0,
        reaction_time:  reaction_time_instance ? reaction_time_instance.to_hundreds / 100.0 : 0.0,
        stroke_type_id: stroke_type_id,
        user_id:        @current_user.id
      )
      sql_attributes = mrs.attributes.select do |key|
        [
          'id', 'minutes', 'seconds', 'hundreds',
          'reaction_time',
          'stroke_type_id', 'swimmer_id', 'badge_id', 'user_id',
          'meeting_relay_result_id'
        ].include?( key.to_s )
      end
      sql_diff_text_log << to_sql_update( mrs, false, sql_attributes, "\r\n" )
    else 
    end
    mrs
  end
def edit_existing_row! ( mrs , swimmer_id , badge_id , stroke_type_id , timing_instance , reaction_time_instance ) return nil unless swimmer_id . present? && badge_id . present? if is_an_actual_update_of ( mrs , swimmer_id , badge_id , timing_instance , reaction_time_instance ) mrs . update! ( swimmer_id : swimmer_id , badge_id : badge_id , minutes : timing_instance ? timing_instance . minutes : 0 , seconds : timing_instance ? timing_instance . seconds : 0 , hundreds : timing_instance ? timing_instance . hundreds : 0 , reaction_time : reaction_time_instance ? reaction_time_instance . to_hundreds / 100.0 : 0.0 , stroke_type_id : stroke_type_id , user_id : @current_user . id ) sql_attributes = mrs . attributes . select do | key | [ 'id' , 'minutes' , 'seconds' , 'hundreds' , 'reaction_time' , 'stroke_type_id' , 'swimmer_id' , 'badge_id' , 'user_id' , 'meeting_relay_result_id' ] . include? ( key . to_s ) end sql_diff_text_log << to_sql_update ( mrs , false , sql_attributes , "\r\n" ) else end mrs end
Edits an existing row id assuming its new timing value is specified as
an incremental timing (as a string).
Edits an existing row id assuming its new timing value is specified as an incremental timing ( as a string ) .
# DEBUG #    puts "\r\nedit_existing_row( mrs.id: #{ mrs.id }, swimmer_id: #{ swimmer_id }, badge_id: #{ badge_id }, stroke_type_id: #{ stroke_type_id }, timing: #{ timing_instance }, reaction_time: #{ reaction_time_instance })" #    puts "before UPDATE" # Store Db-diff text for UPDATE # (log no-op) # DEBUG #      puts "No actual changes detected. Skipping update."
mrs
<not_specific>
swimmer_id
<not_specific>
badge_id
<not_specific>
stroke_type_id
<not_specific>
timing_instance
<not_specific>
reaction_time_instance
<not_specific>