From e460a83806f5d75bdc9bd88f88e18c75f3cc9880 Mon Sep 17 00:00:00 2001 From: Christian Lawson-Perfect Date: Fri, 8 Nov 2024 14:38:44 +0000 Subject: [PATCH] offline analysis: clear reviewing_file when you go back to the table --- themes/default/files/scripts/analysis-display.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/default/files/scripts/analysis-display.js b/themes/default/files/scripts/analysis-display.js index 56aa6037b..6d5381d43 100644 --- a/themes/default/files/scripts/analysis-display.js +++ b/themes/default/files/scripts/analysis-display.js @@ -489,7 +489,7 @@ Numbas.queueScript('analysis-display', ['base','download','util','csv','display- return af; })); } - if(state.reviewing_file !== undefined && state.reviewing_file >=0) { + if(state.reviewing_file !== undefined && state.reviewing_file !== null && state.reviewing_file >=0) { const af = this.uploaded_files()[state.reviewing_file]; af.decryptPromise.then(() => { this.review_file(af); @@ -501,7 +501,7 @@ Numbas.queueScript('analysis-display', ['base','download','util','csv','display- current_tab: this.current_tab(), table_format: this.table_format().label, files: this.uploaded_files().map(f => f.as_json()), - reviewing_file: this.uploaded_files().indexOf(this.reviewing_file()) + reviewing_file: this.current_tab() == 'review' ? this.uploaded_files().indexOf(this.reviewing_file()) : undefined }; if(window.history.state?.current_tab != state.current_tab) {