diff --git a/js/predictions.js b/js/predictions.js index 0a280cc..9a50b9e 100644 --- a/js/predictions.js +++ b/js/predictions.js @@ -845,15 +845,21 @@ function analyze_possibilities(sell_prices, first_buy, previous_pattern) { poss.weekGuaranteedMinimum = Math.max(...weekMins); poss.weekMax = Math.max(...weekMaxes); } + category_totals = {} + for (let i of ["Fluctuating", "Decreasing", "Small spike", "Large spike"]) { + category_totals[i] = generated_possibilities + .filter(value => value.pattern_description == i) + .map(value => value.probability) + .reduce((previous, current) => previous + current, 0) + console.log(category_totals[i]) + } + + for (let pos of generated_possibilities) { + pos.category_total_probability = category_totals[pos.pattern_description] + } generated_possibilities.sort((a, b) => { - if (a.weekMax < b.weekMax) { - return 1; - } else if (a.weekMax > b.weekMax) { - return -1; - } else { - return 0; - } + return b.category_total_probability - a.category_total_probability }); global_min_max = []; diff --git a/js/scripts.js b/js/scripts.js index e13b254..e4812a7 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -256,9 +256,18 @@ const calculateOutput = function (data, first_buy, previous_pattern) { } let output_possibilities = ""; let analyzed_possibilities = analyze_possibilities(data, first_buy, previous_pattern); + previous_pattern_description = "" for (let poss of analyzed_possibilities) { var out_line = "