From 1c1de4d5a80b859b4e5b38c4bf28a9c7a6dfdfa4 Mon Sep 17 00:00:00 2001 From: skanderm Date: Fri, 1 Nov 2024 15:41:15 -0700 Subject: [PATCH] Sort detection marks in candidate page by timestamp (#688) --- 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)),