actually fix result's order

This commit is contained in:
ajuvercr 2020-09-14 22:31:31 +02:00
parent edfd9c02ac
commit bb1e2723e5

View file

@ -153,12 +153,11 @@
} }
function show_result(result) { function show_result(result) {
console.log(result);
while (resultWrapper.lastElementChild) { while (resultWrapper.lastElementChild) {
resultWrapper.removeChild(resultWrapper.lastElementChild); resultWrapper.removeChild(resultWrapper.lastElementChild);
} }
for (let [ver, val] of Object.entries(result).sort(([k1, v1]) => k1).stableSort(([k1, v1], [k2, v2]) => v2 - v1)) { for (let [ver, val] of Object.entries(result).sortByKey(([k1, v1]) => k1).stableSort(([k1, v1], [k2, v2]) => v2 - v1)) {
if(!(ver in _results)) { if(!(ver in _results)) {
console.error("No html found for '"+ver+"'"); console.error("No html found for '"+ver+"'");
continue; continue;
@ -177,21 +176,6 @@
window.sessionStorage.setItem(state.question.id, JSON.stringify(state.answers)); window.sessionStorage.setItem(state.question.id, JSON.stringify(state.answers));
} }
function getSelectValues(select) {
var result = [];
var options = select && select.options;
var opt;
for (var i=0, iLen=options.length; i<iLen; i++) {
opt = options[i];
if (opt.selected) {
result.push(opt.value || opt.text);
}
}
return result;
}
function goNext() { function goNext() {
window.history.pushState("object or string", "", createRelativeUrl(state.question.index + 1)); window.history.pushState("object or string", "", createRelativeUrl(state.question.index + 1));
depth += 1; depth += 1;