diff --git a/ruby/lib/jam_ruby/models/active_music_session.rb b/ruby/lib/jam_ruby/models/active_music_session.rb index edc98fd9f..b3640ec75 100644 --- a/ruby/lib/jam_ruby/models/active_music_session.rb +++ b/ruby/lib/jam_ruby/models/active_music_session.rb @@ -450,7 +450,7 @@ module JamRuby [music_sessions, user_scores] end - def self.participant_create user, music_session_id, client_id, as_musician, tracks + def self.participant_create user, music_session_id, client_id, as_musician, tracks, audio_latency music_session = MusicSession.find(music_session_id) if music_session.active_music_session @@ -462,7 +462,7 @@ module JamRuby active_music_session.with_lock do # VRFS-1297 active_music_session.tick_track_changes - connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, 10) + connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, audio_latency) if connection.errors.any? # rollback the transaction to make sure nothing is disturbed in the database @@ -519,7 +519,7 @@ module JamRuby # auto-join this user into the newly created session as_musician = true - connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, 10) + connection = ConnectionManager.new.join_music_session(user, client_id, active_music_session, as_musician, tracks, audio_latency) unless connection.errors.any? user.update_progression_field(:first_music_session_at) diff --git a/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb b/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb index 50b542b89..9bc6a742c 100644 --- a/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb +++ b/ruby/lib/jam_ruby/models/email_batch_scheduled_sessions.rb @@ -140,8 +140,7 @@ INNER JOIN users ON users.id = msess.user_id INNER JOIN rsvp_slots AS rs ON rs.music_session_id = msess.id LEFT JOIN rsvp_requests_rsvp_slots AS rrrs ON rrrs.rsvp_slot_id = rs.id WHERE - musician_access = 't' AND - approval_required = 'f' AND + open_rsvps = TRUE AND users.last_jam_locidispid IS NOT NULL AND msess.created_at > '#{earliest_session_create_time}' AND msess.created_at < '#{latest_session_create_time}' AND diff --git a/ruby/lib/jam_ruby/models/music_session.rb b/ruby/lib/jam_ruby/models/music_session.rb index 290fd93f4..35a5a7892 100644 --- a/ruby/lib/jam_ruby/models/music_session.rb +++ b/ruby/lib/jam_ruby/models/music_session.rb @@ -10,7 +10,7 @@ module JamRuby RECURRING_MODES = [NO_RECURRING, RECURRING_WEEKLY] - attr_accessor :legal_terms, :language_description, :access_description + attr_accessor :legal_terms, :language_description, :access_description, :scheduling_info_changed attr_accessor :approved_rsvps, :open_slots, :pending_invitations @@ -58,11 +58,17 @@ module JamRuby before_create :generate_share_token before_create :add_to_feed #before_save :update_scheduled_start + before_save :check_scheduling_info_changed SHARE_TOKEN_LENGTH = 8 SEPARATOR = '|' + def check_scheduling_info_changed + @scheduling_info_changed = scheduled_start_changed? + true + end + def add_to_feed feed = Feed.new feed.music_session = self diff --git a/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb b/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb index b632234bc..c23eca414 100644 --- a/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb +++ b/ruby/spec/jam_ruby/models/email_batch_spec_scheduled_session.rb @@ -89,6 +89,16 @@ describe EmailBatchScheduledSessions do expect(UserMailer.deliveries.length).to eq(2) end + it "won't find an open_rsvps=false session" do + session1.open_rsvps = false + session1.save! + session2.open_rsvps = false + session2.save! + + obj = scheduled_batch.fetch_recipients + expect(obj.count).to eq(0) + end + it 'handles large batches' do creators = [] 8.downto(1) do |nn| diff --git a/ruby/spec/jam_ruby/models/music_session_spec.rb b/ruby/spec/jam_ruby/models/music_session_spec.rb index ad4cc67de..f7b9f2a8f 100644 --- a/ruby/spec/jam_ruby/models/music_session_spec.rb +++ b/ruby/spec/jam_ruby/models/music_session_spec.rb @@ -779,5 +779,20 @@ describe MusicSession do end end end + + describe "scheduled session rescheduled logic" do + + it "detect change to scheduling info" do + + music_session1.description = "Hey!" + music_session1.save! + music_session1.scheduling_info_changed.should be_false + + music_session1.scheduled_start = Time.now - 1.days + music_session1.save! + music_session1.scheduling_info_changed.should be_true + + end + end end diff --git a/web/app/assets/javascripts/jam_rest.js b/web/app/assets/javascripts/jam_rest.js index 36cdcffc7..619ea3036 100644 --- a/web/app/assets/javascripts/jam_rest.js +++ b/web/app/assets/javascripts/jam_rest.js @@ -883,11 +883,7 @@ dataType: "json", contentType: 'application/json', url: "/api/users/progression/certified_gear", - processData: false, - data: JSON.stringify({ - success: options.success, - reason: options.reason - }) + data: JSON.stringify(options) }); } @@ -1184,17 +1180,6 @@ }); } - function updateAudioLatency(options) { - var id = getId(options); - return $.ajax({ - type: "POST", - url: '/api/users/' + id + '/audio_latency', - dataType: "json", - contentType: 'application/json', - data: options, - }); - } - function initialize() { return self; } @@ -1298,7 +1283,6 @@ this.getChatMessages = getChatMessages; this.createDiagnostic = createDiagnostic; this.getLatencyTester = getLatencyTester; - this.updateAudioLatency = updateAudioLatency; return this; }; diff --git a/web/app/assets/javascripts/wizard/gear_test.js b/web/app/assets/javascripts/wizard/gear_test.js index 032a427f2..c6c897daf 100644 --- a/web/app/assets/javascripts/wizard/gear_test.js +++ b/web/app/assets/javascripts/wizard/gear_test.js @@ -433,7 +433,7 @@ context.JK.GA.trackAudioTestData(uniqueDeviceName(), context.JK.GA.AudioTestDataReasons.pass, latencyScore); - rest.userCertifiedGear({success: true, client_id: app.clientId, audio_latency: getLatencyScore()}); + rest.userCertifiedGear({success: true, client_id: app.clientId, audio_latency: getLatencyScore().latency}); } function onGearTestFail(e, data) { diff --git a/web/app/assets/javascripts/wizard/gear_utils.js b/web/app/assets/javascripts/wizard/gear_utils.js index 6eb7aa2eb..13e182582 100644 --- a/web/app/assets/javascripts/wizard/gear_utils.js +++ b/web/app/assets/javascripts/wizard/gear_utils.js @@ -269,14 +269,6 @@ return result; } - gearUtils.updateAudioLatency = function(app) { - var latency = jamClient.FTUEGetExpectedLatency().latency; - return rest.updateAudioLatency({client_id: app.clientId, audio_latency: latency}) - .fail(function(jqXHR) { - app.notifyServerError(jqXHR, "Unable to sync audio latency") - }); - } - // if the user has a good user network score, immediately returns with a resolved deferred object. // if not, the user will have the network test dialog prompted... once it's closed, then you'll be told reject() if score is still bad, or resolve() if now good gearUtils.guardAgainstBadNetworkScore = function(app) { diff --git a/web/app/controllers/api_music_sessions_controller.rb b/web/app/controllers/api_music_sessions_controller.rb index ca84595f0..eae4ec2fb 100644 --- a/web/app/controllers/api_music_sessions_controller.rb +++ b/web/app/controllers/api_music_sessions_controller.rb @@ -224,7 +224,8 @@ class ApiMusicSessionsController < ApiController response.status = :unprocessable_entity respond_with @music_session else - Notification.send_scheduled_session_rescheduled(@music_session) + Notification.send_scheduled_session_rescheduled(@music_session) if @music_session.scheduling_info_changed + respond_with @music_session, responder: ApiResponder, :location => api_session_history_detail_url(@music_session) end else @@ -287,7 +288,8 @@ class ApiMusicSessionsController < ApiController params[:id], params[:client_id], params[:as_musician], - params[:tracks] + params[:tracks], + params[:audio_latency] ) if @connection.errors.any? diff --git a/web/app/controllers/api_scoring_controller.rb b/web/app/controllers/api_scoring_controller.rb index 34420e355..a72f5e579 100644 --- a/web/app/controllers/api_scoring_controller.rb +++ b/web/app/controllers/api_scoring_controller.rb @@ -24,6 +24,9 @@ class ApiScoringController < ApiController conn = Connection.where(client_id: clientid, user_id: current_user.id).first if conn.nil? then render :json => {message: 'session not found'}, :status => 404; return end + + if conn.locidispid.nil? then render :json => {message: 'no locidispid for connection'}, :status => 404; return end + # if !current_user.id.eql?(conn.user.id) then render :json => {message: 'session not owned by user'}, :status => 403; return end result_client_ids = JamRuby::GetWork.get_work_list(conn.locidispid, conn.addr) diff --git a/web/app/controllers/api_users_controller.rb b/web/app/controllers/api_users_controller.rb index 27f5f268d..30d507bc7 100644 --- a/web/app/controllers/api_users_controller.rb +++ b/web/app/controllers/api_users_controller.rb @@ -534,7 +534,7 @@ class ApiUsersController < ApiController if !@user.errors.any? # update audio gear latency information - @user.update_audio_latency(connection, params[:audio_latency]) + @user.update_audio_latency(connection, params[:audio_latency]) if params[:audio_latency] end else @user.failed_qualification(params[:reason]) diff --git a/web/spec/features/profile_history_spec.rb b/web/spec/features/profile_history_spec.rb index ef500f420..551b1dc22 100644 --- a/web/spec/features/profile_history_spec.rb +++ b/web/spec/features/profile_history_spec.rb @@ -8,6 +8,7 @@ describe "Profile History", :js => true, :type => :feature, :capybara_feature => before do MusicSession.delete_all + ActiveMusicSession.delete_all Recording.delete_all set_login_cookie user stub_const("APP_CONFIG", web_config) diff --git a/web/spec/support/app_config.rb b/web/spec/support/app_config.rb index 166145ae4..762168dde 100644 --- a/web/spec/support/app_config.rb +++ b/web/spec/support/app_config.rb @@ -54,6 +54,10 @@ def web_config def max_track_part_upload_failures 3 end + + def icecast_hardcoded_source_password + 'blueberryjam' + end end klass.new end