Conversation
| export const formsRouter = Router(); | ||
|
|
||
| const getCollection = flow( | ||
| export const getCollection = flow( |
There was a problem hiding this comment.
| export const getCollection = flow( | |
| export const getFormsCollection = flow( |
if you are exporting it, make sure it has a well defined name in other modules
| const newFuelData: GeneralFuelData = { | ||
| fullGame: calcAverageFuelObject( | ||
| accumulatedFuelData.fullGame, | ||
| currentFuelData.fullGame, | ||
| ), | ||
| auto: calcAverageFuelObject( | ||
| accumulatedFuelData.auto, | ||
| currentFuelData.auto, | ||
| ), | ||
| tele: calcAverageFuelObject( | ||
| accumulatedFuelData.tele, | ||
| currentFuelData.tele, | ||
| ), | ||
| }; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
make sure to merge master and use the calculateAverage function in @repo/array-utils
| forms.map((form) => { | ||
| const newFuelData: TeamNumberAndFuelData = { | ||
| teamNumber: form.teamNumber, | ||
| generalFuelData: generalCalculateFuel(form, EXAMPLE_BPS), | ||
| }; | ||
| return newFuelData; | ||
| }), |
There was a problem hiding this comment.
| 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), | |
| })), |
There was a problem hiding this comment.
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
| generalFuelsData.forEach((current) => { | ||
| if (teamMap.has(current.teamNumber)) return; |
There was a problem hiding this comment.
consider filtering the array by this condition first
| ), | ||
|
|
||
| map((generalFuelsData) => { | ||
| const teamMap: Map<number, TeamNumberAndFuelData> = new Map(); |
There was a problem hiding this comment.
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"; |
There was a problem hiding this comment.
we need to fix this on your computer 😭
| <Route path="/scout" element={<ScoutMatch />} /> | ||
| </Routes> | ||
| <> | ||
| <GeneralDataTable filters={{ "match[type]": "qualification" }} /> |
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.