From 1cbd387065203a0965cd4a918836d90e36eaf04a Mon Sep 17 00:00:00 2001 From: Kornilovich Mikhail Date: Sat, 9 Dec 2023 10:56:12 +0300 Subject: [PATCH] fixes --- .../admin/src/components/SniperLocator.js | 20 +++++++++---------- .../main/kotlin/org/icpclive/sniper/Util.kt | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/frontend/admin/src/components/SniperLocator.js b/src/frontend/admin/src/components/SniperLocator.js index ee39dc4ab..c09f95303 100644 --- a/src/frontend/admin/src/components/SniperLocator.js +++ b/src/frontend/admin/src/components/SniperLocator.js @@ -144,12 +144,19 @@ const SniperViewManager = ({ service }) => { } }, [selectedInstance]); + const [selectedTeamName, selectedTeamCdsId] = useMemo(() => { + if (selectedTeamId === undefined) { + return ["", null]; + } + const team = teams.find(team => team.id === selectedTeamId); + return [team?.name ?? "", team?.contestSystemId]; + }, [teams, selectedTeamId]); + const onMove = useCallback(() => { const settings = { sniperId: sniper, - teamId: selectedTeamId, + teamId: selectedTeamCdsId, }; - console.log(settings); service.moveWithSettings(settings); setSelectedInstance(undefined); setSelectedTeamId(undefined); @@ -158,7 +165,7 @@ const SniperViewManager = ({ service }) => { const onShow = useCallback(() => { const settings = { sniperId: sniper, - teamId: selectedTeamId, + teamId: selectedTeamCdsId, }; service.showWithSettings(settings); setSelectedInstance(undefined); @@ -169,13 +176,6 @@ const SniperViewManager = ({ service }) => { service.hide(); }, [service]); - const selectedTeamName = useMemo(() => { - if (selectedTeamId === undefined) { - return ""; - } - return teams.find(team => team.id === selectedTeamId).name; - }, [teams, selectedTeamId]); - return ( diff --git a/src/sniper-locator-controller/src/main/kotlin/org/icpclive/sniper/Util.kt b/src/sniper-locator-controller/src/main/kotlin/org/icpclive/sniper/Util.kt index d72f2c94b..9bb57d5aa 100644 --- a/src/sniper-locator-controller/src/main/kotlin/org/icpclive/sniper/Util.kt +++ b/src/sniper-locator-controller/src/main/kotlin/org/icpclive/sniper/Util.kt @@ -74,7 +74,7 @@ object Util { } fun loadLocatorPoints(sniperNumber: Int): List { - val scanner = Scanner(Config.configDirectory.resolve("/coordinates-$sniperNumber.txt")) + val scanner = Scanner(Config.configDirectory.resolve("coordinates-$sniperNumber.txt").toFile()) val n = scanner.nextInt() val allPoints = mutableListOf()