Skip to content

Conversation

@karnishein
Copy link
Contributor

@karnishein karnishein commented Feb 11, 2026

compares between two teams

image image

@karnishein karnishein self-assigned this Feb 11, 2026
@karnishein karnishein added the feature A new Feature! label Feb 11, 2026
reason:
"Compare Two Validation Error: Forms contain data from multiple different teams.",
});
}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this really needed? find out if this is redundant and if not, consider type checking the query instead or maybe even moving to a body.

import { spawn } from "child_process";

const isDev = process.env.NODE_ENV === "DEV";
const isDev = process.env.NODE_ENV !== "DEV";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove before merging

Comment on lines +117 to +120
const [firstTeam, secondTeam] = await Promise.all([
fetchTeamCompareData(firstElement(selectedTeams)),
fetchTeamCompareData(secondElement(selectedTeams)),
]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider just mapping the selected teams to fetchTeamCompare

: "bg-rose-500/5 text-rose-500/60 border-rose-500/10";
};

const levelToScore = (level: string) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using a keyof Levels or something apropriate instead of string. (idk the correct type here just use somoething narrower than string)


export const compareRouter = Router();

type GamePeriod = "auto" | "fullGame";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about autonomous? Consider adding it


export const compareRouter = Router();

type GamePeriod = "auto" | "fullGame";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about teleop? Consider adding it


type GamePeriod = "auto" | "fullGame";

const DIGITS_AFTER_DOT = 2;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider renaming it to 'DIFITS_AFTER_DECIMAL_DOT'

const calculateAverageScoredFuel = (
forms: ScoutingForm[],
gamePeriod: GamePeriod,
) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider declaring a type 'L1 | L2 | L3 | L4' that the function will return

: "L0";
};

const findTimesClimbedToMax = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider changing it to 'findTimesClimbedToMax'

Comment on lines +15 to +36
const fetchTeamCompareData = async (teamNumber: number) => {
const params = new URLSearchParams({ teamNumber: teamNumber.toString() });
const url = `${compareUrl}?${params.toString()}`;

try {
const response = await fetch(url, {
method: "GET",
headers: { "Content-Type": "application/json" },
});

if (!response.ok) {
const errorText = await response.text();
throw new Error(`Server Error: ${errorText}`);
}

const data = await response.json();
return data.teamCompareData as TeamCompareData;
} catch (err) {
console.error("Fetch failed:", err);
throw err;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider moving this function to the backend, and call it in the frontend

console.error("Fetch failed:", err);
throw err;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

Comment on lines +59 to +63
const StatBox = ({
label,
value,
color,
}: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider declaring an interface statBoxProps

</div>
);

const LevelMiniStat = ({ label, count }: { label: string; count: number }) => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, consider adding props

};

const handleCompare = async () => {
if (selectedTeams.length !== MAX_SELECTED_TEAMS) return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (selectedTeams.length !== MAX_SELECTED_TEAMS) return;
if (selectedTeams.length <= MAX_SELECTED_TEAMS) return;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new Feature!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants