Fix wish ordering
parent
4bc8cdd68a
commit
781ec913f2
|
@ -347,10 +347,7 @@
|
||||||
const importedWishes = wishes[code].slice().reverse();
|
const importedWishes = wishes[code].slice().reverse();
|
||||||
const oldestWish = importedWishes[0];
|
const oldestWish = importedWishes[0];
|
||||||
|
|
||||||
localWishes = localWishes
|
localWishes = localWishes.slice().filter((e) => e.time < oldestWish.time);
|
||||||
.slice()
|
|
||||||
.filter((e) => e.time < oldestWish.time)
|
|
||||||
.sort((a, b) => a.time - b.time);
|
|
||||||
|
|
||||||
const combined = [...localWishes, ...importedWishes];
|
const combined = [...localWishes, ...importedWishes];
|
||||||
|
|
||||||
|
|
|
@ -99,7 +99,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function addPullDetail(newPull) {
|
function addPullDetail(newPull) {
|
||||||
pulls = [...pulls, newPull];
|
let index = -1;
|
||||||
|
for (let i = pulls.length - 1; i >= 0; i--) {
|
||||||
|
if (newPull.time >= pulls[i].time) {
|
||||||
|
index = i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const lastPulls = [...pulls];
|
||||||
|
lastPulls.splice(index, 0, newPull);
|
||||||
|
pulls = lastPulls;
|
||||||
closeModal();
|
closeModal();
|
||||||
saveData();
|
saveData();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue