Skip to content

Commit

Permalink
fix: sort localstorage
Browse files Browse the repository at this point in the history
  • Loading branch information
yb6b committed Mar 24, 2024
1 parent ac83b5d commit ff98577
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/train/useReview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,13 @@ export function useReview<T>(name: string, cards: T[]) {
storageRef.value.push([-1, i])
}
}
storageRef.value.sort((a, b) => {
if (a[0] === 8 && b[0] < 8)
return 1
if (b[0] === 8 && a[0] < 8)
return -1
return 0
})

const scanProgress = () => storageRef.value.reduce((p, c) => p + Number(c[0] > 1), 0)
const progress = shallowRef(scanProgress())
Expand Down

0 comments on commit ff98577

Please sign in to comment.