fixed challenges clearing themselves when loaded. closes #1790

This commit is contained in:
Jack 2021-08-31 14:23:59 +01:00
parent cf32d1999a
commit a7b2a5d442

View file

@ -6,11 +6,13 @@ import * as TestLogic from "./test-logic";
import * as Funbox from "./funbox";
import Config, * as UpdateConfig from "./config";
import * as UI from "./ui";
import * as TestUI from "./test-ui";
export let active = null;
let challengeLoading = false;
export function clearActive() {
if (active) {
if (active && !challengeLoading && !TestUI.testRestarting) {
Notifications.add("Challenge cleared", 0);
active = null;
}
@ -125,6 +127,7 @@ export function verify(result) {
}
export async function setup(challengeName) {
challengeLoading = true;
if (!$(".page.pageTest").hasClass("active")) {
UI.changePage("", true);
}
@ -219,6 +222,7 @@ export async function setup(challengeName) {
Notifications.add("Challenge loaded. " + notitext, 0);
}
active = challenge;
challengeLoading = false;
} catch (e) {
Notifications.add("Something went wrong: " + e, -1);
}