Fix wish ordering
parent
4bc8cdd68a
commit
781ec913f2
|
@ -347,10 +347,7 @@
|
|||
const importedWishes = wishes[code].slice().reverse();
|
||||
const oldestWish = importedWishes[0];
|
||||
|
||||
localWishes = localWishes
|
||||
.slice()
|
||||
.filter((e) => e.time < oldestWish.time)
|
||||
.sort((a, b) => a.time - b.time);
|
||||
localWishes = localWishes.slice().filter((e) => e.time < oldestWish.time);
|
||||
|
||||
const combined = [...localWishes, ...importedWishes];
|
||||
|
||||
|
|
|
@ -99,7 +99,16 @@
|
|||
}
|
||||
|
||||
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();
|
||||
saveData();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue