From d6a0dca23a1989fdca4793cf8e7e07224f45fcfa Mon Sep 17 00:00:00 2001 From: No1mann Date: Fri, 15 Dec 2023 16:17:55 -0500 Subject: [PATCH 1/3] Fix extra data being added to the graph --- website/script.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/website/script.js b/website/script.js index 33d3f21..05925ca 100644 --- a/website/script.js +++ b/website/script.js @@ -696,11 +696,13 @@ for (let year of JingleJam.current) { year[1].forEach(x => data.labels.add(x.x)); - let currentData = year[1].map(function (m) { return { x: m.x, y: m[JingleJam.settings.isPounds ? 'p' : 'd'] }; }); - currentData.push({ - x: JingleJam.model.date.getTime(), - y: JingleJam.settings.isPounds ? JingleJam.model.raised.yogscast + JingleJam.model.raised.fundraisers : (JingleJam.model.raised.yogscast + JingleJam.model.raised.fundraisers) * JingleJam.model.avgConversionRate - }) + if(JingleJam.model.isLive()){ + let currentData = year[1].map(function (m) { return { x: m.x, y: m[JingleJam.settings.isPounds ? 'p' : 'd'] }; }); + currentData.push({ + x: JingleJam.model.date.getTime(), + y: JingleJam.settings.isPounds ? JingleJam.model.raised.yogscast + JingleJam.model.raised.fundraisers : (JingleJam.model.raised.yogscast + JingleJam.model.raised.fundraisers) * JingleJam.model.avgConversionRate + }); + } data.datasets.push({ label: year[0], From 1d6ab11689776420ab4bc6141ad86b8245885336 Mon Sep 17 00:00:00 2001 From: No1mann Date: Fri, 15 Dec 2023 16:19:09 -0500 Subject: [PATCH 2/3] Fix function call --- website/script.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/script.js b/website/script.js index 05925ca..af2a58c 100644 --- a/website/script.js +++ b/website/script.js @@ -696,7 +696,7 @@ for (let year of JingleJam.current) { year[1].forEach(x => data.labels.add(x.x)); - if(JingleJam.model.isLive()){ + if(JingleJam.isLive()){ let currentData = year[1].map(function (m) { return { x: m.x, y: m[JingleJam.settings.isPounds ? 'p' : 'd'] }; }); currentData.push({ x: JingleJam.model.date.getTime(), From 781ece4c63e96b9eb3147ff4beb4e5bd3bfbcd67 Mon Sep 17 00:00:00 2001 From: No1mann Date: Fri, 15 Dec 2023 16:21:46 -0500 Subject: [PATCH 3/3] Fix compile error --- website/script.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/website/script.js b/website/script.js index af2a58c..61efeae 100644 --- a/website/script.js +++ b/website/script.js @@ -696,8 +696,9 @@ for (let year of JingleJam.current) { year[1].forEach(x => data.labels.add(x.x)); + let currentData = year[1].map(function (m) { return { x: m.x, y: m[JingleJam.settings.isPounds ? 'p' : 'd'] }; }); + if(JingleJam.isLive()){ - let currentData = year[1].map(function (m) { return { x: m.x, y: m[JingleJam.settings.isPounds ? 'p' : 'd'] }; }); currentData.push({ x: JingleJam.model.date.getTime(), y: JingleJam.settings.isPounds ? JingleJam.model.raised.yogscast + JingleJam.model.raised.fundraisers : (JingleJam.model.raised.yogscast + JingleJam.model.raised.fundraisers) * JingleJam.model.avgConversionRate