VRFS-4127 - clean up msuh after disconnect
This commit is contained in:
parent
6ab4775f96
commit
bc63407bb7
|
|
@ -1,3 +1,4 @@
|
|||
ALTER TABLE lesson_sessions ADD COLUMN user_id VARCHAR(64) REFERENCES users(id);
|
||||
UPDATE lesson_sessions SET user_id = (select user_id from music_sessions where lesson_sessions.id = music_sessions.lesson_session_id) where user_id is NULL;
|
||||
ALTER TABLE lesson_sessions ALTER COLUMN user_id SET NOT NULL;
|
||||
ALTER TABLE lesson_sessions ALTER COLUMN user_id SET NOT NULL;
|
||||
CREATE INDEX msuh_client_id ON music_sessions_user_history USING btree (client_id);
|
||||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
$parent.data('lessonSessionActions', options)
|
||||
function onLessonActionSelected() {
|
||||
console.log("ON LESSION SECTION ANTHOUNHSE")
|
||||
var $li = $(this);
|
||||
var lessonAction = $li.attr('data-lesson-option');
|
||||
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ LessonTimerActions = context.LessonTimerActions
|
|||
|
||||
lesson = @findLesson($node.attr('data-lesson-id'))
|
||||
|
||||
$node.lessonSessionActions(lesson).on(context.JK.EVENTS.LESSON_SESSION_ACTION, @lessonSessionActionSelected)
|
||||
$node.lessonSessionActions(lesson).off(context.JK.EVENTS.LESSON_SESSION_ACTION).on(context.JK.EVENTS.LESSON_SESSION_ACTION, @lessonSessionActionSelected)
|
||||
))
|
||||
|
||||
context.JK.popExternalLinks(@root)
|
||||
|
|
@ -519,7 +519,11 @@ LessonTimerActions = context.LessonTimerActions
|
|||
|
||||
if lessonData.times? && lessonData.displayStatus == 'Scheduled'
|
||||
if lessonData.times.startingSoon
|
||||
timeStmt = `<span>Starts in {lessonData.times.until.minutes} minutes. <a
|
||||
if lessonData.times.until.minutes == 0
|
||||
timeDesc = "Starts in less than a minute"
|
||||
else
|
||||
timeDesc = "Starts in #{lessonData.times.until.minutes} minutes."
|
||||
timeStmt = `<span>{timeDesc}<a
|
||||
onClick={this.joinLessonNow.bind(this, lessonData)}>join lesson now</a></span>`
|
||||
else if lessonData.times.inThePast
|
||||
minutes = -lessonData.times.until.minutes
|
||||
|
|
|
|||
|
|
@ -37,9 +37,9 @@ rest = new context.JK.Rest()
|
|||
|
||||
if untilInfo.total < 0
|
||||
# we are past the start time
|
||||
if untilInfo.total > -(10 * 60 * 1000) # 10 minutes
|
||||
if -untilInfo.total < (10 * 60 * 1000) # 10 minutes
|
||||
initialWindow = true
|
||||
else if untilInfo.total > -(lesson.duration*60*1000) # duration
|
||||
if -untilInfo.total < (lesson.duration*60*1000) # duration
|
||||
inThePast = true
|
||||
else
|
||||
# we are before the due time
|
||||
|
|
|
|||
|
|
@ -1469,6 +1469,13 @@ module JamWebsockets
|
|||
user = User.find_by_id(user_id) unless user_id.nil?
|
||||
if music_session
|
||||
|
||||
msuh = MusicSessionUserHistory.find_by_client_id(cid).order('updated_at DESC').first
|
||||
if msuh
|
||||
msuh.session_removed_at = Time.now if msuh.session_removed_at.nil?
|
||||
msuh.save(validate:false)
|
||||
end
|
||||
|
||||
|
||||
recording = music_session.stop_recording
|
||||
unless recording.nil?
|
||||
@log.debug "stopped recording: #{recording.id} because user #{user} reconnected"
|
||||
|
|
|
|||
Loading…
Reference in New Issue