Index: lams_tool_assessment/web/pages/learning/learning.jsp =================================================================== diff -u -rb98f30903ddbc02662891534c9e5e1dee75c64ce -r39898a6bc099395132ff585dae1a8848058b86bb --- lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision b98f30903ddbc02662891534c9e5e1dee75c64ce) +++ lams_tool_assessment/web/pages/learning/learning.jsp (.../learning.jsp) (revision 39898a6bc099395132ff585dae1a8848058b86bb) @@ -183,12 +183,7 @@ }); return totalSelected; } - - //boolean to indicate whether ok dialog is still ON so that autosave can't be run - // var isWaitingForConfirmation = ${isTimeLimitEnabled && sessionMap.isTimeLimitNotLaunched}; - - // TIME LIMIT // websocket needs pinging and reconnection feature in case it fails @@ -312,8 +307,18 @@ //autosave feature - - function learnerAutosave(){ + var autosaveInterval = ${isLeadershipEnabled and isUserLeader ? 10000 : 30000}; // 30 or 10 seconds interval + + function learnerAutosave(isCommand){ + // isCommand means that the autosave was triggered by force complete or another command websocket message + // in this case do not check multiple tabs open, just autosave + if (!isCommand) { + let shouldAutosave = preventLearnerAutosaveFromMultipleTabs(autosaveInterval); + if (!shouldAutosave) { + return; + } + } + if (typeof CodeMirror != 'undefined') { $('.CodeMirror').each(function(){ this.CodeMirror.save(); @@ -349,7 +354,6 @@ error : onLearnerAutosaveError }); } - var autosaveInterval = ${isLeadershipEnabled and isUserLeader ? 10000 : 30000}; // 30 or 10 seconds interval window.setInterval(learnerAutosave, autosaveInterval); function onLearnerAutosaveError() {