From c23c87bc382ae089dcb632004b3b9224703d0324 Mon Sep 17 00:00:00 2001 From: Skander Mzali Date: Thu, 17 Oct 2024 13:23:49 -0700 Subject: [PATCH] Sort detection marks in candidate page by timestamp --- ui/src/components/DetectionsTable.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/src/components/DetectionsTable.tsx b/ui/src/components/DetectionsTable.tsx index 8ba673ed..99e23955 100644 --- a/ui/src/components/DetectionsTable.tsx +++ b/ui/src/components/DetectionsTable.tsx @@ -75,7 +75,13 @@ export default function DetectionsTable({ a.id.localeCompare(b.id)) + .sort(({ timestamp: a }, { timestamp: b }) => { + const date_a = new Date(a); + const date_b = new Date(b); + + // Sort by timestamp, low to high + return +date_a - +date_b; + }) .map((d, index) => ({ label: (index + 1).toString(), value: Number((+d.playerOffset - +startOffset).toFixed(1)),