From 0102dc1806bd926ccef2f67c2459e4b23bf68f77 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 16 Mar 2023 14:46:34 +0100 Subject: [PATCH 1/2] optional for a while --- backend/src/api/schemas/config-schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/api/schemas/config-schema.ts b/backend/src/api/schemas/config-schema.ts index 5c3009630..3a8b8733b 100644 --- a/backend/src/api/schemas/config-schema.ts +++ b/backend/src/api/schemas/config-schema.ts @@ -87,7 +87,7 @@ const CONFIG_SCHEMA = joi.object({ paceCaretCustomSpeed: joi.number().min(0), repeatedPace: joi.boolean(), pageWidth: joi.string().valid("100", "125", "150", "200", "max"), - accountChart: joi.array().items(joi.string()), + accountChart: joi.array().items(joi.string()).optional(), chartAccuracy: joi.boolean().optional(), //remove after a bit chartStyle: joi.string().valid("line", "scatter").optional(), //remove after a bit minWpm: joi.string().valid("off", "custom"), From a04768bbfaa406b20f9ff8a5702b371a798be2c0 Mon Sep 17 00:00:00 2001 From: Miodec Date: Thu, 16 Mar 2023 15:39:19 +0100 Subject: [PATCH 2/2] temporary account history graph fix --- frontend/src/ts/pages/account.ts | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/frontend/src/ts/pages/account.ts b/frontend/src/ts/pages/account.ts index d40b2aa0e..94a044574 100644 --- a/frontend/src/ts/pages/account.ts +++ b/frontend/src/ts/pages/account.ts @@ -739,17 +739,19 @@ function fillContent(): void { chartData.forEach((a) => { if (a.y > currentPb) { currentPb = a.y; - pb.push(a); + //todo: remove temporary fix + // pb.push(a); } }); // add last point to pb const xMax = chartData.length; - pb.push({ - x: xMax, - y: pb[pb.length - 1].y, - }); + //todo: remove temporary fix + // pb.push({ + // x: xMax, + // y: pb[pb.length - 1].y, + // }); const avgTen = []; const avgTenAcc = []; @@ -785,6 +787,15 @@ function fillContent(): void { avgHundredAcc.push({ x: i + 1, y: accAvgHundredValue }); } + //todo: remove temporary fix + for (let i = 0; i < chartData.length; i++) { + chartData[i].x = i + 1; + } + + for (let i = 0; i < accChartData.length; i++) { + accChartData[i].x = i + 1; + } + ChartController.accountHistory.data.datasets[0].data = chartData; ChartController.accountHistory.data.datasets[1].data = pb; ChartController.accountHistory.data.datasets[2].data = accChartData;