Changed activation logic

This commit is contained in:
Estebene 2021-05-16 11:26:00 +12:00
parent 2f9d5fdfdd
commit fdf6aa3b0b
2 changed files with 8 additions and 9 deletions

View file

@ -6,7 +6,7 @@ import * as DB from "./db";
export let settings = null;
function resetCaretPosition() {
if (Config.paceCaret === "off") return;
if (Config.paceCaret === "off" && !TestLogic.isPaceRepeat) return;
if (!$("#paceCaret").hasClass("hidden")) {
$("#paceCaret").addClass("hidden");
}
@ -40,9 +40,7 @@ export async function init() {
mode2 = TestLogic.randomQuote.id;
}
let wpm;
if (TestLogic.isPaceRepeat == true) {
wpm = TestLogic.lastTestWpm;
} else if (Config.paceCaret === "pb") {
if (Config.paceCaret === "pb") {
wpm = await DB.getLocalPB(
Config.mode,
mode2,
@ -71,8 +69,9 @@ export async function init() {
console.log("avg pace " + wpm);
} else if (Config.paceCaret === "custom") {
wpm = Config.paceCaretCustomSpeed;
} else if (TestLogic.isPaceRepeat == true) {
wpm = TestLogic.lastTestWpm;
}
if (wpm < 1 || wpm == false || wpm == undefined || Number.isNaN(wpm)) {
settings = null;
return;

View file

@ -490,19 +490,19 @@ export function updateModesNotice() {
);
}
if (Config.paceCaret !== "off") {
if (Config.paceCaret !== "off" || TestLogic.isPaceRepeat) {
let speed = "";
try {
speed = ` (${Math.round(PaceCaret.settings.wpm)} wpm)`;
} catch {}
$(".pageTest #testModesNotice").append(
`<div class="text-button" commands="commandsPaceCaret"><i class="fas fa-tachometer-alt"></i>${
TestLogic.isPaceRepeat
? "repeated"
: Config.paceCaret === "average"
Config.paceCaret === "average"
? "average"
: Config.paceCaret === "pb"
? "pb"
: Config.paceCaret == "off"
? "repeated"
: "custom"
} pace${speed}</div>`
);