* VRFS-1992 - check open_rsvps for daily session email, VRFS-1991 - remove hardcoded 10 in audio latency on create/join, VRFS-1990 - only send update rsvp notification if scheduled start time changes

This commit is contained in:
Seth Call 2014-07-30 15:11:03 -05:00
parent bb66a7ac9a
commit 8966a3fc2f
13 changed files with 51 additions and 35 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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|

View File

@ -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

View File

@ -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;
};

View File

@ -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) {

View File

@ -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) {

View File

@ -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?

View File

@ -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)

View File

@ -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])

View File

@ -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)

View File

@ -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