Update to provide consistent cross-browser behavior.

Changes the sorting in `generate_possibilities` to have the intended effect. The old version worked on firefox, but did not sort the list on chrome because `a.weekMax < b.weekMax` does not return `-1` if `a.weekMax > b.weekMax`.
master
Phoenix Meadowlark 4 years ago committed by GitHub
parent 8afadbddeb
commit 927480748c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -654,7 +654,15 @@ function analyze_possibilities(sell_prices, first_buy, previous_pattern) {
poss.weekMax = Math.max(...weekMaxes);
}
generated_possibilities.sort((a, b) => a.weekMax < b.weekMax);
generated_possibilities.sort((a, b) => {
if (a.weekMax < b.weekMax) {
return 1;
} else if (a.weekMax > b.weekMax) {
return -1;
} else {
return 0;
}
});
return generated_possibilities;
}

Loading…
Cancel
Save