diff --git a/index.html b/index.html index c64963f..af325bc 100644 --- a/index.html +++ b/index.html @@ -213,6 +213,7 @@ +
diff --git a/js/predictions.js b/js/predictions.js index 9a50b9e..a6d00d2 100644 --- a/js/predictions.js +++ b/js/predictions.js @@ -845,21 +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"]) { + for (let i of [0, 1, 2, 3]) { category_totals[i] = generated_possibilities - .filter(value => value.pattern_description == i) + .filter(value => value.pattern_number == i) .map(value => value.probability) - .reduce((previous, current) => previous + current, 0) - console.log(category_totals[i]) + .reduce((previous, current) => previous + current, 0); } for (let pos of generated_possibilities) { - pos.category_total_probability = category_totals[pos.pattern_description] + pos.category_total_probability = category_totals[pos.pattern_number]; } generated_possibilities.sort((a, b) => { - return b.category_total_probability - a.category_total_probability + return b.category_total_probability - a.category_total_probability || b.probability - a.probability; }); global_min_max = []; diff --git a/js/scripts.js b/js/scripts.js index e4812a7..a60bc60 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -256,18 +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 = "" + previous_pattern_number = "" for (let poss of analyzed_possibilities) { var out_line = "" + poss.pattern_description + "" - if (previous_pattern_description != poss.pattern_description) { - previous_pattern_description = poss.pattern_description + if (previous_pattern_number != poss.pattern_number) { + previous_pattern_number = poss.pattern_number pattern_count = analyzed_possibilities - .filter(val => val.pattern_description == poss.pattern_description) + .filter(val => val.pattern_number == poss.pattern_number) .length percentage_display = percent => Number.isFinite(percent) ? ((percent * 100).toPrecision(3) + '%') : '—' - out_line += `${percentage_display(poss.category_total_probability)}
`; - out_line += Number.isFinite(poss.probability) ? `(${pattern_count} @ ${percentage_display(poss.probability)})` : ""; + out_line += `${percentage_display(poss.category_total_probability)}`; } + out_line += `${percentage_display(poss.probability)}`; for (let day of poss.prices.slice(1)) { if (day.min !== day.max) { out_line += `${day.min} ${i18next.t("output.to")} ${day.max}`;