diff --git a/backend/src/api/schemas/config-schema.ts b/backend/src/api/schemas/config-schema.ts index a2e980e37..d72064365 100644 --- a/backend/src/api/schemas/config-schema.ts +++ b/backend/src/api/schemas/config-schema.ts @@ -76,7 +76,7 @@ const CONFIG_SCHEMA = joi.object({ startGraphsAtZero: joi.boolean(), swapEscAndTab: joi.boolean(), showOutOfFocusWarning: joi.boolean(), - paceCaret: joi.string().valid("off", "average", "pb", "custom"), + paceCaret: joi.string().valid("off", "average", "pb", "last", "custom"), paceCaretCustomSpeed: joi.number().min(0), repeatedPace: joi.boolean(), pageWidth: joi.string().valid("100", "125", "150", "200", "max"), diff --git a/frontend/src/ts/config.ts b/frontend/src/ts/config.ts index f6152c323..e3cc4df0d 100644 --- a/frontend/src/ts/config.ts +++ b/frontend/src/ts/config.ts @@ -355,7 +355,9 @@ export function setPaceCaret( nosave?: boolean ): boolean { if ( - !isConfigValueValid("pace caret", val, [["custom", "off", "average", "pb"]]) + !isConfigValueValid("pace caret", val, [ + ["custom", "off", "average", "pb", "last"], + ]) ) { return false; } diff --git a/frontend/src/ts/elements/commandline-lists.ts b/frontend/src/ts/elements/commandline-lists.ts index af4722d4e..3d3e387a6 100644 --- a/frontend/src/ts/elements/commandline-lists.ts +++ b/frontend/src/ts/elements/commandline-lists.ts @@ -1492,6 +1492,15 @@ const commandsPaceCaret: MonkeyTypes.CommandsGroup = { TestLogic.restart(); }, }, + { + id: "setPaceCaretLast", + display: "last", + configValue: "last", + exec: (): void => { + UpdateConfig.setPaceCaret("last"); + TestLogic.restart(); + }, + }, { id: "setPaceCaretAverage", display: "average", diff --git a/frontend/src/ts/elements/modes-notice.ts b/frontend/src/ts/elements/modes-notice.ts index 33bc2ca6f..b2bd97d0d 100644 --- a/frontend/src/ts/elements/modes-notice.ts +++ b/frontend/src/ts/elements/modes-notice.ts @@ -100,6 +100,8 @@ export async function update(): Promise { ? "average" : Config.paceCaret === "pb" ? "pb" + : Config.paceCaret === "last" + ? "last" : "custom" } pace${speed}` ); diff --git a/frontend/src/ts/test/pace-caret.ts b/frontend/src/ts/test/pace-caret.ts index 402a23562..03fd629eb 100644 --- a/frontend/src/ts/test/pace-caret.ts +++ b/frontend/src/ts/test/pace-caret.ts @@ -77,7 +77,7 @@ export async function init(): Promise { wpm = Math.round(wpm); } else if (Config.paceCaret === "custom") { wpm = Config.paceCaretCustomSpeed; - } else if (TestState.isPaceRepeat == true) { + } else if (Config.paceCaret === "last" || TestState.isPaceRepeat == true) { wpm = TestStats.lastTestWpm; } if (wpm === undefined || wpm < 1 || Number.isNaN(wpm)) { diff --git a/frontend/src/ts/types/types.d.ts b/frontend/src/ts/types/types.d.ts index 9a5dd8253..2bc461e38 100644 --- a/frontend/src/ts/types/types.d.ts +++ b/frontend/src/ts/types/types.d.ts @@ -92,7 +92,7 @@ declare namespace MonkeyTypes { type SoundVolume = "0.1" | "0.5" | "1.0"; - type PaceCaret = "off" | "average" | "pb" | "custom"; + type PaceCaret = "off" | "average" | "pb" | "last" | "custom"; type PageWidth = "100" | "125" | "150" | "200" | "max"; diff --git a/frontend/static/html/pages/settings.html b/frontend/static/html/pages/settings.html index 9ca76928f..c52cb3400 100644 --- a/frontend/static/html/pages/settings.html +++ b/frontend/static/html/pages/settings.html @@ -1022,7 +1022,7 @@ tabindex="0" onclick="this.blur();" > - average + avg
pb
+
+ last +