Fix order if wallet with no priority exists

This commit is contained in:
ekzyis 2024-07-08 11:06:46 +02:00
parent 920478a72c
commit 1a60f13d72
1 changed files with 6 additions and 0 deletions

View File

@ -95,6 +95,12 @@ export default function Wallet ({ ssrData }) {
// delta is NaN if either priority is undefined
if (!Number.isNaN(delta) && delta !== 0) return delta
// if one wallet has a priority but the other one doesn't, the one with the priority comes first
if (w1.priority !== undefined && w2.priority === undefined) return -1
if (w1.priority === undefined && w2.priority !== undefined) return 1
// both wallets have no priority set, falling back to other methods
// if both wallets have an id, use that as tie breaker
// since that's the order in which autowithdrawals are attempted
if (w1.id && w2.id) return Number(w1.id) - Number(w2.id)