app/strategies/meeting_reservation_updater.rb
# Edits an existing detail row id (either a MeetingEventReservation or MeetingRelayReservation
# instance). The MeetingEvent is used to discriminate between model types.
# This method updates also the internal SQL diff log file.
#
# == Returns:
#
# The specified MeetingEventReservation or MeetingRelayReservation instance.
# Returns +nil+ only in case of no-operations.
#
Edits an existing detail row id (either a MeetingEventReservation or MeetingRelayReservation
instance). The MeetingEvent is used to discriminate between model types.
This method updates also the internal SQL diff log file.




Edits an existing detail row id ( either a MeetingEventReservation or MeetingRelayReservation instance ) . The MeetingEvent is used to discriminate between model types . This method updates also the internal SQL diff log file .
def edit_existing_detail_row!( mres, event, is_doing_this, suggested_timing = nil, notes = nil )
    return nil unless event.instance_of?(MeetingEvent) && (mres.instance_of?(MeetingEventReservation) || mres.instance_of?(MeetingRelayReservation))
    if is_an_actual_detail_update_of( mres, is_doing_this, suggested_timing, notes )
      sql_attributes = []
      if event.event_type.is_a_relay?
        mres.update!(
          is_doing_this:      is_doing_this,
          notes:              notes,
          user_id:            @current_user.id
        )
        sql_attributes = mres.attributes.select do |key|
          [ 'id', 'is_doing_this', 'notes', 'user_id' ].include?( key.to_s )
        end
      else
        mres.update!(
          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
        )
        sql_attributes = mres.attributes.select do |key|
          [
            'id', 'is_doing_this', 'suggested_minutes', 'suggested_seconds', 'suggested_hundreds',
            'user_id'
          ].include?( key.to_s )
        end
      end
      sql_diff_text_log << to_sql_update( mres, false, sql_attributes, "\r\n" )
    end
    mres
  end
def edit_existing_detail_row! ( mres , event , is_doing_this , suggested_timing = nil , notes = nil ) return nil unless event . instance_of? ( MeetingEvent ) && ( mres . instance_of? ( MeetingEventReservation ) || mres . instance_of? ( MeetingRelayReservation ) ) if is_an_actual_detail_update_of ( mres , is_doing_this , suggested_timing , notes ) sql_attributes = [ ] if event . event_type . is_a_relay? mres . update! ( is_doing_this : is_doing_this , notes : notes , user_id : @current_user . id ) sql_attributes = mres . attributes . select do | key | [ 'id' , 'is_doing_this' , 'notes' , 'user_id' ] . include? ( key . to_s ) end else mres . update! ( 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 ) sql_attributes = mres . attributes . select do | key | [ 'id' , 'is_doing_this' , 'suggested_minutes' , 'suggested_seconds' , 'suggested_hundreds' , 'user_id' ] . include? ( key . to_s ) end end sql_diff_text_log << to_sql_update ( mres , false , sql_attributes , "\r\n" ) end mres end
Edits an existing detail row id (either a MeetingEventReservation or MeetingRelayReservation
instance).
Edits an existing detail row id ( either a MeetingEventReservation or MeetingRelayReservation instance ) .
# DEBUG #    puts "\r\nedit_existing_detail_row!( #{ mres.class }: mres.id: #{ mres.id }, event: #{ event.get_full_name }, is_doing_this: #{ is_doing_this }, timing: #{ suggested_timing }, notes: '#{ notes }')" #    puts "before UPDATE" # DEBUG #      puts "before detail UPDATE!" # DEBUG #      puts "before sql_diff_text_log," #      puts "mres: #{ mres.inspect }" #    else # (log no-op) # DEBUG #      puts "No actual changes detected. Skipping update."
mres
<not_specific>
event
<not_specific>
is_doing_this
<not_specific>
suggested_timing
<not_specific>
notes
<not_specific>