bugfixing

This commit is contained in:
MuslemRahimi 2024-09-22 20:49:21 +02:00
parent 918f2578ce
commit c8723ddca0

View File

@ -68,9 +68,9 @@ function computeWinRate(data) {
function getPlotOptions() {
let dates = [];
const returnMap = {};
const reverseData = data?.getCramerTracker?.reverse();
// Iterate over the data and sum the returnSince values for each unique date
reverseData?.forEach(item => {
rawData?.forEach(item => {
const { date, returnSince } = item;
if (returnMap[date]) {
@ -81,10 +81,12 @@ function getPlotOptions() {
}
});
// Convert the returnMap to an array of objects (cumulativeList)
cumulativeList = Object?.keys(returnMap)?.map(date => (
returnMap[date]?.toFixed(1)
));
// Sort dates in ascending order (earliest date first, latest date last)
dates?.sort((a, b) => new Date(a) - new Date(b));
// Convert the returnMap to an array of objects (cumulativeList) in the correct order
cumulativeList = dates?.map(date => (returnMap[date]?.toFixed(1)));
//console.log('Cumulative List:', cumulativeList);
//console.log('Unique Dates:', dates);
@ -373,7 +375,6 @@ function getPlotOptions() {
</Card.Root>
</div>