From 0e9f31c6081c46c1cf889cbd2892f18ed7e80a3a Mon Sep 17 00:00:00 2001 From: Frederick Zhang Date: Sat, 29 Jun 2024 18:31:32 -0700 Subject: [PATCH] populate playerWon on endtimestamp instead of start --- app/(interactive)/tag-match/page.js | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/(interactive)/tag-match/page.js b/app/(interactive)/tag-match/page.js index 470be8d..dfdb6f0 100644 --- a/app/(interactive)/tag-match/page.js +++ b/app/(interactive)/tag-match/page.js @@ -51,8 +51,8 @@ const KeybindingsTable = () => { Pause/Play - [d] [g] [f] - Start Timestamp, Player1Won | Start Timestamp, Player2Won | End Timestamp + [d] [f] [g] + Start Timestamp | End Timestamp, Player 1 Won | End Timestamp, Player 2 Won [r] [e] @@ -106,20 +106,17 @@ export default function TagMatch() { "d": () => { const newTimestamp = Math.round(videoObject.getCurrentTime() * 1000); if (!timeList.some(pair => pair[1] === 0)) { - setTimeList(timeList => [...timeList, [newTimestamp, 0, "Player 1"]].sort((pair1, pair2) => pair1[0] - pair2[0])); + setTimeList(timeList => [...timeList, [newTimestamp, 0, ""]].sort((pair1, pair2) => pair1[0] - pair2[0])); setCurTimeStart(newTimestamp); } }, "f": () => { const newTimestamp = Math.round(videoObject.getCurrentTime() * 1000); - setTimeList(timeList => timeList.map(pair => (pair[1] === 0 && newTimestamp >= pair[0]) ? [pair[0], newTimestamp, pair[2]] : pair)); + setTimeList(timeList => timeList.map(pair => (pair[1] === 0 && newTimestamp >= pair[0]) ? [pair[0], newTimestamp, 'Player 1'] : pair)); }, "g": () => { const newTimestamp = Math.round(videoObject.getCurrentTime() * 1000); - if (!timeList.some(pair => pair[1] === 0)) { - setTimeList(timeList => [...timeList, [newTimestamp, 0, "Player 2"]].sort((pair1, pair2) => pair1[0] - pair2[0])); - setCurTimeStart(newTimestamp); - } + setTimeList(timeList => timeList.map(pair => (pair[1] === 0 && newTimestamp >= pair[0]) ? [pair[0], newTimestamp, 'Player 2'] : pair)); }, "r": () => videoObject.seekTo(videoObject.getCurrentTime() + 1 / FRAMERATE, true), "e": () => videoObject.seekTo(videoObject.getCurrentTime() - 1 / FRAMERATE, true),