diff --git a/db/up/track_user_on_lesson.sql b/db/up/track_user_on_lesson.sql index a18a19a86..a5e381d96 100644 --- a/db/up/track_user_on_lesson.sql +++ b/db/up/track_user_on_lesson.sql @@ -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; \ No newline at end of file +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); \ No newline at end of file diff --git a/web/app/assets/javascripts/jquery.lessonSessionActions.js b/web/app/assets/javascripts/jquery.lessonSessionActions.js index bff821074..cec184edf 100644 --- a/web/app/assets/javascripts/jquery.lessonSessionActions.js +++ b/web/app/assets/javascripts/jquery.lessonSessionActions.js @@ -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'); diff --git a/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee b/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee index 223e9e4e6..2278b6627 100644 --- a/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/JamClassScreen.js.jsx.coffee @@ -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 = `Starts in {lessonData.times.until.minutes} minutes. {timeDesc}join lesson now` else if lessonData.times.inThePast minutes = -lessonData.times.until.minutes diff --git a/web/app/assets/javascripts/react-components/stores/LessonTimerStore.js.coffee b/web/app/assets/javascripts/react-components/stores/LessonTimerStore.js.coffee index 7a3985e0e..b30a6870a 100644 --- a/web/app/assets/javascripts/react-components/stores/LessonTimerStore.js.coffee +++ b/web/app/assets/javascripts/react-components/stores/LessonTimerStore.js.coffee @@ -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 diff --git a/websocket-gateway/lib/jam_websockets/router.rb b/websocket-gateway/lib/jam_websockets/router.rb index 8cb0290e7..1626d7a54 100644 --- a/websocket-gateway/lib/jam_websockets/router.rb +++ b/websocket-gateway/lib/jam_websockets/router.rb @@ -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"