saving the last result when a user signs up

This commit is contained in:
Jack 2020-08-30 06:32:22 +01:00
parent c94dcafd20
commit 05b7b8c37f
2 changed files with 11 additions and 0 deletions

View file

@ -154,6 +154,15 @@ function signUp() {
personalBests: {},
tags: [],
};
if (notSignedInLastResult !== null) {
notSignedInLastResult.uid = usr.uid;
testCompleted({
uid: usr.uid,
obj: notSignedInLastResult,
});
dbSnapshot.results.push(notSignedInLastResult);
config.resultFilters = defaultAccountFilters;
}
changePage("account");
})
.catch(function (error) {

View file

@ -36,6 +36,7 @@ let focusState = false;
let activeFunBox = "none";
let manualRestart = false;
let bailout = false;
let notSignedInLastResult = null;
let themeColors = {
bg: "#323437",
@ -1947,6 +1948,7 @@ function showResult(difficultyFailed = false) {
} catch (e) {
console.log("Analytics unavailable");
}
notSignedInLastResult = completedEvent;
// showNotification("Sign in to save your result",3000);
}