Skip to content

Commit

Permalink
Fast fix locator
Browse files Browse the repository at this point in the history
  • Loading branch information
Konstantin Bats committed Sep 17, 2024
1 parent 3059720 commit 4c12d51
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/frontend/locator/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ function App() {
<AppNav/>
<Routes>
<Route path="/" element={<OracleLocator/>}/>
<Route path="/oracleLocator" element={<OracleLocator/>}/>
<Route path="/locator" element={<OracleLocator/>}/>
<Route path="/oracleCalibrator" element={<Calibrator/>}/>
</Routes>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/locator/src/AppNav.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import MenuIcon from "@mui/icons-material/Menu";
import PropTypes from "prop-types";

const pages = {
"Oracle Locator": "oracleLocator",
"Oracle Locator": "locator",
"Oracle Calibrator": "oracleCalibrator"
};

Expand Down
7 changes: 4 additions & 3 deletions src/frontend/locator/src/components/OracleLocator.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ const isTeamSatisfiesSearch = (team, searchValue) => {
if (searchValue === "" || team.id === null) {
return true;
}
return (team.contestSystemId + " : " + team.shortName + " : " + team.name).toLowerCase().includes(searchValue);
return (team.id + " : " + team.shortName + " : " + team.name).toLowerCase().includes(searchValue);
};

const useTeamsList = (rawTeams, status) => {
const [selectedTeamId, setSelectedTeamId] = useState(undefined);
const teamsWithStatus = useMemo(
() => rawTeams.map(t => ({
...t,
shown: Object.values(status).some(s => s.shown && s.settings.teamId === t.id),
shown: Object.values(status).some(s => s.shown && s.settings.id === t.id),
selected: t.id === selectedTeamId,
})),
[rawTeams, status, selectedTeamId]);
Expand Down Expand Up @@ -150,10 +150,11 @@ const OracleViewManager = ({ service }) => {
return ["", null];
}
const team = teams.find(team => team.id === selectedTeamId);
return [team?.name ?? "", team?.contestSystemId];
return [team?.name ?? "", team?.id];
}, [teams, selectedTeamId]);

const onMove = useCallback(() => {
console.log("OnMove", selectedTeamCdsId)
const settings = {
oracleId: oracle,
teamId: selectedTeamCdsId,
Expand Down
6 changes: 3 additions & 3 deletions src/frontend/locator/src/components/TeamTable.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const gridButton = {

export const TEAM_FIELD_STRUCTURE = PropTypes.shape({
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
contestSystemId: PropTypes.string,
teamId: PropTypes.string,
shown: PropTypes.bool.isRequired,
selected: PropTypes.bool.isRequired,
name: PropTypes.string.isRequired,
Expand Down Expand Up @@ -46,8 +46,8 @@ const TeamTableRow = ({ rowData, onClick, tStyle }) => {
color: (rowData.selected || rowData.shown ? grey[900] : grey[700]) }}
onClick={() => onClick(rowData.id)}
>
{rowData.contestSystemId && `${rowData.contestSystemId} :`}
{rowData.contestSystemId === null && <AutoModeIcon sx={{ mr: 1 }} />}
{rowData.teamId && `${rowData.teamId} :`}
{rowData.teamId === null && <AutoModeIcon sx={{ mr: 1 }} />}
{" " + rowData.name}
</Box>
</Grid>);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data class TeamLocatorCircleSettings(
val x: Int,
val y: Int,
val radius: Int,
val cdsTeamId: String,
val teamId: String,
)

@Serializable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ object LocatorController {
x = it.x.toInt(),
y = it.y.toInt(),
radius = it.r.toInt(),
cdsTeamId = it.id,
teamId = it.id,
)
}
)
Expand Down

0 comments on commit 4c12d51

Please sign in to comment.