Skip to content

Commit

Permalink
vinvoor: reverse scan order
Browse files Browse the repository at this point in the history
  • Loading branch information
Topvennie authored and hannes-dev committed Aug 12, 2024
1 parent d6bdb6e commit 73cfb4c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion vinvoor/src/scans/ScansTableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ export const ScansTableBody: FC<ScansTableBodyProps> = ({ scans, cards }) => {
const [scanCards, setScanCards] = useState<readonly ScanCard[]>([]);

useEffect(() => {
setScanCards(mergeScansCards(scans, cards));
const mergedScansCards = mergeScansCards(scans, cards);
mergedScansCards.sort(
(a, b) => b.scanTime.getTime() - a.scanTime.getTime()
);
setScanCards(mergedScansCards);
}, [scans, cards]);

return (
Expand Down
2 changes: 1 addition & 1 deletion vinvoor/src/types/scans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const convertScanJSON = (scansJSON: ScanJSON[]): Scan[] =>
export const mergeScansCards = (
scans: readonly Scan[],
cards: readonly Card[]
): readonly ScanCard[] =>
): ScanCard[] =>
scans.map((scan) => ({
scanTime: scan.scanTime,
card: cards.find((card) => card.serial === scan.cardSerial),
Expand Down

0 comments on commit 73cfb4c

Please sign in to comment.