Skip to content

General data showing#40

Open
karnishein wants to merge 9 commits intomasterfrom
general-data-showing
Open

General data showing#40
karnishein wants to merge 9 commits intomasterfrom
general-data-showing

Conversation

@karnishein
Copy link
Contributor

did some backend for the data, and a table to display it. still not sure the table works, will check after we'll have db and shyte.

image

export const formsRouter = Router();

const getCollection = flow(
export const getCollection = flow(
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
export const getCollection = flow(
export const getFormsCollection = flow(

if you are exporting it, make sure it has a well defined name in other modules

Comment on lines +67 to +80
const newFuelData: GeneralFuelData = {
fullGame: calcAverageFuelObject(
accumulatedFuelData.fullGame,
currentFuelData.fullGame,
),
auto: calcAverageFuelObject(
accumulatedFuelData.auto,
currentFuelData.auto,
),
tele: calcAverageFuelObject(
accumulatedFuelData.tele,
currentFuelData.tele,
),
};
Copy link
Contributor

Choose a reason for hiding this comment

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

this is not really an average. since you are averaging two fuel objects over and over again, each consecutive fuel has half as much of an influence as the last. the fuels contribute, in order, something like this:
1/2 + 1/4 + 1/8 + 1/16 .... + 1/2^(n-1) + 1/2^(n-1),
instead of what an average should be:
1/n + 1/n + 1/n + 1/n ... + 1/n

Copy link
Contributor

Choose a reason for hiding this comment

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

make sure to merge master and use the calculateAverage function in @repo/array-utils

Comment on lines +95 to +101
forms.map((form) => {
const newFuelData: TeamNumberAndFuelData = {
teamNumber: form.teamNumber,
generalFuelData: generalCalculateFuel(form, EXAMPLE_BPS),
};
return newFuelData;
}),
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
forms.map((form) => {
const newFuelData: TeamNumberAndFuelData = {
teamNumber: form.teamNumber,
generalFuelData: generalCalculateFuel(form, EXAMPLE_BPS),
};
return newFuelData;
}),
forms.map((form) => ({
teamNumber: form.teamNumber,
generalFuelData: generalCalculateFuel(form, EXAMPLE_BPS),
})),

Copy link
Contributor

Choose a reason for hiding this comment

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

consider not typing stuff like this, as it is redundant. only type stuff if you are planning to use a specific union in it (like typing a number as a 0 | 1 or a string as a "red" | "blue). the beauty of io-ts is that it infers the type in the next function

Comment on lines +106 to +107
generalFuelsData.forEach((current) => {
if (teamMap.has(current.teamNumber)) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

consider filtering the array by this condition first

),

map((generalFuelsData) => {
const teamMap: Map<number, TeamNumberAndFuelData> = new Map();
Copy link
Contributor

Choose a reason for hiding this comment

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

consider setting the info of the map when creating it, so that you dont have to insert every time.
make the values ahead of time in objects or something, and then put them in the map

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.

we need to fix this on your computer 😭

<Route path="/scout" element={<ScoutMatch />} />
</Routes>
<>
<GeneralDataTable filters={{ "match[type]": "qualification" }} />
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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants