been at this too long. i want it done and over!
Now everything works except the 3.26 price vs 100 cash. it gives me an extra quarter, and ignores the dollar! Ive narrowed the ‘evilness’ to this area. For some reason, i get 204.99999999997!
filteredCid.forEach(elem => {
let curr = elem[0];
let currSum = Math.round(elem[1] * 100);
cidSum += currSum;
console.log(cidSum)
return {'statu let amount = 0;
while (changeSum >= benji[curr] && currSum > 0) {
amount += benji[curr];
changeSum -= benji[curr];
currSum -= benji[curr];
}
if (amount !== 0) {
change.push([curr, amount / 100]);
}
});
if (changeSum > 0) {
status = 'INSUFFICIENT_FUNDS';
change = [];
}
else if (changeSum == 0 && changeSumCheck == cidSum) {
status = 'CLOSED';
change = cid;
console.log(change)
} else {
status = 'OPEN';
}s': status,'change': change};