diff --git a/.github/workflows/build-docs.yml b/.github/workflows/build-docs.yml deleted file mode 100644 index 0c25bf2..0000000 --- a/.github/workflows/build-docs.yml +++ /dev/null @@ -1,46 +0,0 @@ -name: Build and Deploy Documentation - -on: - push: - branches: - - production - - testing - - code-cleanup - workflow_dispatch: - -env: - INSTANCE: 'Documentation/cid' - ARTIFACT: 'webHelpCID2-all.zip' - DOCKER_VERSION: '242.21870' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Build docs using Documentation Docker builder - uses: JetBrains/writerside-github-action@v4 - with: - instance: ${{ env.INSTANCE }} - artifact: ${{ env.ARTIFACT }} - docker-version: ${{ env.DOCKER_VERSION }} - - - name: Save artifact with build results - uses: actions/upload-artifact@v4 - with: - name: docs - path: | - artifacts/${{ env.ARTIFACT }} - artifacts/report.json - retention-days: 7 - - - name: Deploy to GitHub Pages - if: ${{ github.ref_name == 'production' }} # Deploy only from the production branch - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: artifacts # Change this to the directory containing built files \ No newline at end of file diff --git a/Documentation/c.list b/Documentation/c.list deleted file mode 100644 index c4c77a2..0000000 --- a/Documentation/c.list +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Documentation/cfg/buildprofiles.xml b/Documentation/cfg/buildprofiles.xml deleted file mode 100644 index fab6b3d..0000000 --- a/Documentation/cfg/buildprofiles.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - true - - - - diff --git a/Documentation/cid.tree b/Documentation/cid.tree deleted file mode 100644 index 758f91d..0000000 --- a/Documentation/cid.tree +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Documentation/images/completion_procedure.png b/Documentation/images/completion_procedure.png deleted file mode 100644 index 3535a3f..0000000 Binary files a/Documentation/images/completion_procedure.png and /dev/null differ diff --git a/Documentation/images/completion_procedure_dark.png b/Documentation/images/completion_procedure_dark.png deleted file mode 100644 index a65beb0..0000000 Binary files a/Documentation/images/completion_procedure_dark.png and /dev/null differ diff --git a/Documentation/images/convert_table_to_xml.png b/Documentation/images/convert_table_to_xml.png deleted file mode 100644 index 2518a64..0000000 Binary files a/Documentation/images/convert_table_to_xml.png and /dev/null differ diff --git a/Documentation/images/convert_table_to_xml_dark.png b/Documentation/images/convert_table_to_xml_dark.png deleted file mode 100644 index 4716122..0000000 Binary files a/Documentation/images/convert_table_to_xml_dark.png and /dev/null differ diff --git a/Documentation/images/new_topic_options.png b/Documentation/images/new_topic_options.png deleted file mode 100644 index bc6abb6..0000000 Binary files a/Documentation/images/new_topic_options.png and /dev/null differ diff --git a/Documentation/images/new_topic_options_dark.png b/Documentation/images/new_topic_options_dark.png deleted file mode 100644 index bf3e48d..0000000 Binary files a/Documentation/images/new_topic_options_dark.png and /dev/null differ diff --git a/Documentation/topics/Components.md b/Documentation/topics/Components.md deleted file mode 100644 index 3b77eb1..0000000 --- a/Documentation/topics/Components.md +++ /dev/null @@ -1,45 +0,0 @@ -# Components - -## Background - -When designing this software, we were faced with a problem. How do we allow for maximum customization year to year -while still keeping the routine maintenance as low as possible? - -_Our solution: Custom Components._ - -Using Vue, we have created a selection of custom components that can be used just like any other HTML element when -designing each years scouting page. You don't HAVE to use these, but you don't have a lot of time to figure out how -to customize this software to fit your needs, these components make year to year changes much more cookie cutter. - -## Introduction to Components - -Navigate to the 'Components' directory inside your project. Notice how the components are organized. -- Season specific components are labeled with the _year_ and then the _season's name_ (ex: 24-crescendo) -- Components for the scouting page are in the 'scouting-components' folder -- Other component folders are created to decrease clutter - -Open the SingleSelect.vue file inside the scouting-components folder - -Notice how components work: - -``` -const props = defineProps<{ - modelValue: number; - options: Array; -}>(); - -const value = computed({ - get() { - return props.modelValue - }, - set(value) { - emit('update:modelValue', value) - }, -}) -``` - -Props are like parameters of a function. These allow you to provide data to the component. Meanwhile, the modelValue -(the emit) acts like a return value of a function. This allows you to output data from the component back into a -script you use it in. - -For the Single Select file, the options prop is used to define \ No newline at end of file diff --git a/Documentation/topics/Docker-Installation.md b/Documentation/topics/Docker-Installation.md deleted file mode 100644 index bee667b..0000000 --- a/Documentation/topics/Docker-Installation.md +++ /dev/null @@ -1,9 +0,0 @@ -# Docker Installation - -In order to run a database, which is necessary to run the website, you must first install Docker. Docker is an application we use which makes it easier to work with databases across different operating systems - -1. Install [Docker](https://www.docker.com/products/docker-desktop/) -2. Find the "compose.yaml" file in your code editor -3. Run line 91, `couch-db-setup:` - -Great! Now you are ready to start coding. diff --git a/Documentation/topics/Getting-Started.md b/Documentation/topics/Getting-Started.md deleted file mode 100644 index 64b4643..0000000 --- a/Documentation/topics/Getting-Started.md +++ /dev/null @@ -1,11 +0,0 @@ -# Getting Started - -## Install the Project - -1. Navigate to the [ChocoChipScouting GitHub page](https://github.com/DurhamAcademy/ChocoChipScouting) -2. Click the green "Code" button and copy the HTTPS url -3. Go to WebStorm or your preferred code editor and import a project from VCS/GitHub -4. Install [Node.js](https://nodejs.org/en) -5. Once you are in your newly created project, open the terminal and run `npm install` in the project directory - -Nice! Now the project and it's dependencies are installed. diff --git a/Documentation/topics/Running-the-Website.md b/Documentation/topics/Running-the-Website.md deleted file mode 100644 index d0a6889..0000000 --- a/Documentation/topics/Running-the-Website.md +++ /dev/null @@ -1,8 +0,0 @@ -# Running the Website - -Awesome! You're all caught up. Now it is time to run the website for the first time. - -1. Navigate to the terminal inside your editor OR navigate to the project directory in your computer's terminal -2. Run `npm run dev` to start the website - -That's it! Click the "Local" link and the website will open. It is as simple as that. \ No newline at end of file diff --git a/Documentation/topics/Seasonal-Updates.md b/Documentation/topics/Seasonal-Updates.md deleted file mode 100644 index 8d3c603..0000000 --- a/Documentation/topics/Seasonal-Updates.md +++ /dev/null @@ -1,3 +0,0 @@ -# Seasonal Updates - -Each season some tasks will need to be completed to update the scouting software to the new game. This section is intended to highlight what may need to be adjusted season to season and explain how to make those changes. \ No newline at end of file diff --git a/Documentation/topics/starter-topic.md b/Documentation/topics/starter-topic.md deleted file mode 100644 index a015d76..0000000 --- a/Documentation/topics/starter-topic.md +++ /dev/null @@ -1,79 +0,0 @@ -# About ChocoChip Internal Documentation - - - -## Add new topics -You can create empty topics, or choose a template for different types of content that contains some boilerplate structure to help you get started: - -![Create new topic options](new_topic_options.png){ width=290 }{border-effect=line} - -## Write content -%product% supports two types of markup: Markdown and XML. -When you create a new help article, you can choose between two topic types, but this doesn't mean you have to stick to a single format. -You can author content in Markdown and extend it with semantic attributes or inject entire XML elements. - -## Inject XML -For example, this is how you inject a procedure: - - - -

Start typing and select a procedure type from the completion suggestions:

- completion suggestions for procedure -
- -

Press Tab or Enter to insert the markup.

-
-
- -## Add interactive elements - -### Tabs -To add switchable content, you can make use of tabs (inject them by starting to type `tab` on a new line): - - - - ![Alt Text](new_topic_options.png){ width=450 } - - - - ]]> - - - -### Collapsible blocks -Apart from injecting entire XML elements, you can use attributes to configure the behavior of certain elements. -For example, you can collapse a chapter that contains non-essential information: - -#### Supplementary info {collapsible="true"} -Content under a collapsible header will be collapsed by default, -but you can modify the behavior by adding the following attribute: -`default-state="expanded"` - -### Convert selection to XML -If you need to extend an element with more functions, you can convert selected content from Markdown to semantic markup. -For example, if you want to merge cells in a table, it's much easier to convert it to XML than do this in Markdown. -Position the caret anywhere in the table and press Alt+Enter: - -Convert table to XML - -## Feedback and support -Please report any issues, usability improvements, or feature requests to our -YouTrack project -(you will need to register). - -You are welcome to join our -public Slack workspace. -Before you do, please read our [Code of conduct](https://plugins.jetbrains.com/plugin/20158-writerside/docs/writerside-code-of-conduct.html). -We assume that you’ve read and acknowledged it before joining. - -You can also always email us at [writerside@jetbrains.com](mailto:writerside@jetbrains.com). - - - - Markup reference - Reorder topics in the TOC - Build and publish - Configure Search - - \ No newline at end of file diff --git a/Documentation/v.list b/Documentation/v.list deleted file mode 100644 index 2d12cb3..0000000 --- a/Documentation/v.list +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/Documentation/writerside.cfg b/Documentation/writerside.cfg deleted file mode 100644 index ec81e4a..0000000 --- a/Documentation/writerside.cfg +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index 8b366c8..9b95be4 100644 --- a/README.md +++ b/README.md @@ -4,81 +4,85 @@ ![chocochip darcside logo](https://github.com/DurhamAcademy/NuxtScoutingSystem/assets/65467501/3d2e1bdc-5a94-475b-8531-84e87ac48413) +## Table of Contents +- [Getting Started](#getting-started) +- [The Basics](#the-basics) +- [Resources](#resources) +## Getting Started +### Install the Project -# Nuxt 3 Minimal Starter +1. Navigate to the [ChocoChipScouting GitHub page](https://github.com/DurhamAcademy/ChocoChipScouting) +2. Click the green "Code" button and copy the HTTPS url +3. Go to WebStorm or your preferred code editor and import a project from VCS/GitHub +4. Install [Node.js](https://nodejs.org/en) +5. Once you are in your newly created project, open the terminal and run `npm install` in the project directory -Look at the [Nuxt 3 documentation](https://nuxt.com/docs/getting-started/introduction) to learn more. +Nice! Now the project and it's dependencies are installed. -## Setup +### Docker Installation -Make sure to install the dependencies: +In order to run a database, which is necessary to run the website, you must first install Docker. Docker is an application we use which makes it easier to work with databases across different operating systems -```bash -# npm -npm install +1. Install [Docker](https://www.docker.com/products/docker-desktop/) +2. Find the "compose.yaml" file in your code editor +3. Run line 91, `couch-db-setup:` -# pnpm -pnpm install +Great! Now you can host a database locally. -# yarn -yarn install +### Setting Up an ENV File -# bun -bun install -``` - -## Development Server - -Start the development server on `http://localhost:3000`: - -```bash -# npm -npm run dev - -# pnpm -pnpm run dev +The final step is set up a .env file. This is an environment file and it will store any secrets we cannot upload to GitHub (for security reasons). Unfortunately, it would make the .env file redundant to post those secrets here. You will have to get them from another user, or create your own. You must create your own .env file in a format that follows the code below (but replace the XXXX's with the secrets): -# yarn -yarn dev - -# bun -bun run dev +``` +NUXT_COUCH_DB_HOSTNAME=XXXX +NUXT_TBA_KEY=XXXX +NUXT_COUCH_DB_SERVER_ADMIN_USER_USERNAME=XXXX +NUXT_COUCH_DB_SERVER_ADMIN_USER_PASSWORD=XXXX ``` -## Production +## The Basics +### Running the Website -Build the application for production: +Awesome! You're done installing. Now it is time to run the website for the first time. -```bash -# npm -npm run build +1. First, open up Docker and ensure you are running the ChocoChip scouting container. Docker contains your local database, so if this isn't running, your website won't work. +2. Navigate to the terminal inside your editor (suggested) OR navigate to the project directory in your computer's terminal +3. Copy and paste `npm run dev` and run it to start the website -# pnpm -pnpm run build +That's it! Click the `Local: http://localhost:3000/` link and the website will open. This is a locally hosted version of the website. Any changes you make to this version of the website won't impact the production website, so feel free to mess around. This includes any data you input, as this is stored locally with Docker. -# yarn -yarn build -# bun -bun run build -``` +## Resources -Locally preview production build: +Now that you have the scouting software up and running, here are some resources. While this README will try to cover the important bits, if you run into any issues or want to add something new, these resources are the first place to look. -```bash -# npm -npm run preview +### Vue +- [Vue](https://vuejs.org/guide/introduction.html) + - This is the framework we use. It allows us to put JS, CSS, and HTML all in the same file (in addition to some other pretty cool stuff). Definitely check this one out if you are curious. +### Nuxt +- [Nuxt](https://nuxt.com/docs/getting-started/introduction) + - Nuxt extends on Vue as a framework. This allows us to do some of the complicated backend that *hopefully* you won't have to deal with every season. + - This is where `npm run dev, npm run build, and npm run preview` come from: [Deployment Documentation](https://nuxt.com/docs/getting-started/deployment). +- [Nuxt UI](https://ui.nuxt.com/getting-started) + - Nuxt UI, on the other hand, is something you will likely use every season. This is a collection of premade HTML components that make building the website easier. If you are updating any of the UI, it is pretty important you check this out. -# pnpm -pnpm run preview +### PouchDB +- [PouchDB](https://pouchdb.com/guides/) + - PouchDB is a database library. This helps us with our website's signature feature: offline data saving. -# yarn -yarn preview +### Vuetify +- [Vuetify](https://vuetifyjs.com/en/components/data-tables/basics/) + - Vuetify is a similar service as Nuxt UI. We mostly stick with Nuxt UI for the sake of conformity, but `/pages/matches.vue` was made significantly easier due to options this library offers. -# bun -bun run preview -``` +### Chart.js +- [Chart.js](https://www.chartjs.org/docs/latest/) + - Chart.js is a chart library that we use to display data. Notice this in the `/components/charts/` folder and on the `/pages/teams/index.vue` and `/pages/teams/[id].vue` pages. +- [Vue Chart](https://vue-chart-3.netlify.app/guide/#introduction) + - Vue Chart is a library that combines with Chart.js to allow us to use Chart.js on a Vue-based website. You can see this in use in the same places as Chart.js. -Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information. +### Prettier/ESlint +- [Prettier](https://prettier.io/docs/en/) +- [ESLint](https://eslint.style/guide/getting-started) + - These two libraries automatically ensure our code follows certain stylistic rules when uploading to GitHub. diff --git a/components/website-utils/Navbar.vue b/components/website-utils/Navbar.vue index 75d3772..fedd380 100644 --- a/components/website-utils/Navbar.vue +++ b/components/website-utils/Navbar.vue @@ -4,6 +4,7 @@ import { loginStateKey } from '~/utils/keys'; import PouchDB from 'pouchdb'; import { eventOptions } from '~/utils/eventOptions'; import { useEventKey } from '~/composables/useEventKey'; +import { VerticalNavigationLink } from '#ui/types'; const { usernameState, sessionState, diff --git a/components/website-utils/OuterComponents.vue b/components/website-utils/OuterComponents.vue index 6f99805..d012e7f 100644 --- a/components/website-utils/OuterComponents.vue +++ b/components/website-utils/OuterComponents.vue @@ -69,7 +69,7 @@ if ( class="vis min-h-screen h-screen max-w-full" > diff --git a/nuxt.config.ts b/nuxt.config.ts index d2585eb..6f0e5e1 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -14,6 +14,7 @@ export default defineNuxtConfig({ }) }, ], + webpack: { aggressiveCodeRemoval: true, optimization: { @@ -29,6 +30,7 @@ export default defineNuxtConfig({ } }, }, + nitro: { preset: 'bun', compressPublicAssets: { @@ -37,6 +39,7 @@ export default defineNuxtConfig({ }, }, + app: { head: { script: [ @@ -46,10 +49,12 @@ export default defineNuxtConfig({ ] } }, + build: { transpile: ['vuetify'], }, + // speedkit: { // // detection: { @@ -101,6 +106,7 @@ export default defineNuxtConfig({ vimeo: 'https://i.vimeocdn.com', } }, + // buildModules: [ // 'nuxt-speedkit', // '@nuxtjs/pwa' @@ -154,9 +160,11 @@ export default defineNuxtConfig({ type: 'module', }, }, + plugins: [ '~/plugins/vuetify.ts' ], + devtools: { enabled: true, @@ -164,7 +172,9 @@ export default defineNuxtConfig({ enabled: true } }, + ssr: false, + vite: { vue: { template: { @@ -172,7 +182,9 @@ export default defineNuxtConfig({ } } }, + logLevel: "verbose", + runtimeConfig:{ tbaKey: process.env.NUXT_TBA_KEY, couchDB: { @@ -183,13 +195,16 @@ export default defineNuxtConfig({ } } }, + sourcemap: { server: true, client: true }, + colorMode: { preference: 'light' //eventually we will add color mode preference }, + tailwindcss:{ config:{ theme: { @@ -215,5 +230,7 @@ export default defineNuxtConfig({ } } } - } + }, + + compatibilityDate: '2025-01-08' }) \ No newline at end of file diff --git a/package.json b/package.json index a1066bd..9b718d1 100644 --- a/package.json +++ b/package.json @@ -18,14 +18,14 @@ "@types/pouchdb": "6.4.0", "@types/sentiment": "^5.0.4", "eslint": "^7.32.0", - "eslint-config-prettier": "^8.3.0", - "eslint-plugin-nuxt": "^2.0.0", - "eslint-plugin-prettier": "^3.4.0", - "eslint-plugin-vue": "^7.15.1", + "eslint-config-prettier": "9.1.0", + "eslint-plugin-nuxt": "4.0.0", + "eslint-plugin-prettier": "4.2.1", + "eslint-plugin-vue": "9.32.0", "husky": "^9.0.11", "lint-staged": "^15.2.7", "nuxt": "^3.10.3", - "prettier": "^2.3.2" + "prettier": "3.4.2" }, "dependencies": { "@nuxt/image": "^1.3.0", diff --git a/pages/dashboard.vue b/pages/dashboard.vue index bbba0eb..1d03d3c 100644 --- a/pages/dashboard.vue +++ b/pages/dashboard.vue @@ -553,7 +553,12 @@ async function updateTeamData() {

No Events Scheduled

- +
diff --git a/pages/notes.vue b/pages/notes.vue index 402318e..a8952da 100644 --- a/pages/notes.vue +++ b/pages/notes.vue @@ -53,7 +53,7 @@ async function submit() { data.value.event = selectedEvent; if (data.value.teamNumber != null) { let doc = db.post(data.value); - await navigateTo('dashboard'); + await navigateTo('/dashboard'); } } diff --git a/pages/scout.vue b/pages/scout.vue index 215c2b1..59567bf 100644 --- a/pages/scout.vue +++ b/pages/scout.vue @@ -10,6 +10,7 @@ import type { Ref } from '@vue/reactivity'; import type { UnwrapRef } from 'vue'; import { loginStateKey } from '~/utils/keys'; import { useEventKey } from '~/composables/useEventKey'; +import SingleSelect from "~/components/scouting-components/SingleSelect.vue"; /* START SEASONAL UPDATE AREA @@ -31,7 +32,11 @@ const endgameOptions = [ 'Deep Successful', ]; -const currentLevel = ref(1); +/* +Used to configure coral buttons + */ +const autoCoralLevel = ref(0); +const teleopCoralLevel = ref(0); /* Configuration variables done @@ -66,6 +71,12 @@ let scoutData = ref({ coralL2: 0, coralL3: 0, coralL4: 0, + coralL1Miss: 0, + coralL2Miss: 0, + coralL3Miss: 0, + coralL4Miss: 0, + reef: 0, + reefMiss: 0, processorMiss: 0, processor: 0, netMiss: 0, @@ -77,6 +88,12 @@ let scoutData = ref({ coralL2: 0, coralL3: 0, coralL4: 0, + coralL1Miss: 0, + coralL2Miss: 0, + coralL3Miss: 0, + coralL4Miss: 0, + reef: 0, + reefMiss: 0, processorMiss: 0, processor: 0, netMiss: 0, @@ -174,7 +191,7 @@ async function submit() { scoutData.value.author = usernameState.value; scoutData.value.event = currentEvent.value || eventOptions[0]; await db.post(scoutData.value); - await navigateTo('/matches'); + await navigateTo('/teams'); } } @@ -253,64 +270,128 @@ async function submit() {
-
-

- Net -

-

- Scored -

- - -
-

- Missed -

- - -
-
-

- Processor +
+

+ Coral Level

Scored

- - -
+
+ + + + + +

Missed

- - -
-
-
-
- - +
+ + + + + +
+
+
+
+

+ Net +

+

+ Scored +

+ +
+

+ Missed +

+ + +
+
+

+ Processor +

+

+ Scored +

+ + +
+

+ Missed +

+ + +
+
+
+
+ + +
+

@@ -318,13 +399,67 @@ async function submit() {
-
-

- Coral +
+

+ Coral Level +

+

+ Scored +

+
+ + + + + +
+

+ Missed

-
- - +
+ + + + +

diff --git a/pages/teams/[id].vue b/pages/teams/[id].vue index ef4fd04..b3120dd 100644 --- a/pages/teams/[id].vue +++ b/pages/teams/[id].vue @@ -220,7 +220,7 @@ watch(width, () => {

Choose Tags To Filter

- +
@@ -134,7 +134,7 @@ async function goBack() {

Choose Events To Filter

- +
diff --git a/pages/teams/index.vue b/pages/teams/index.vue index 8d64439..8496aa2 100644 --- a/pages/teams/index.vue +++ b/pages/teams/index.vue @@ -8,6 +8,7 @@ import IdMeta = PouchDB.Core.IdMeta; import { useWindowSize } from '@vueuse/core'; import PieChart from '~/components/charts/PieChart.vue'; import OuterComponents from '~/components/website-utils/OuterComponents.vue'; +import { TokenFormat } from 'vscode-languageserver-protocol'; //TYLER IS THIS NEEDED IDK let { width, height } = useWindowSize(); @@ -182,12 +183,77 @@ async function tableSetup() { data: Math.round(averageDefensiveScore(data) * 100) / 100, color: '', }, - ampAuto: { - data: Math.round(averageAmpsAuto(data) * 100) / 100, + netAuto: { + data: Math.round(averageNetAuto(data) * 100) / 100, color: '', }, - speakerAuto: { - data: Math.round(averageSpeakersAuto(data) * 100) / 100, + netAutoAccData: netAutoAccuracy(data), + netAutoAcc: { + data: !isNaN(+netAutoAccuracy(data)[1]) + ? Math.round(+netAutoAccuracy(data)[1] * 1000) / 10 + '%' + : '0%', + color: '', + }, + processorAuto: { + data: Math.round(averageProcessorAuto(data) * 100) / 100, + color: '', + }, + processorAutoAccData: processorAutoAccuracy(data), + processorAutoAcc: { + data: !isNaN(+processorAutoAccuracy(data)[1]) + ? Math.round(+processorAutoAccuracy(data)[1] * 1000) / 10 + '%' + : '0%', + color: '', + }, + reefAutoAccData: reefAutoAccuracy(data), + reefAutoAcc: { + data: !isNaN(+reefAutoAccuracy(data)[1]) + ? Math.round(+reefAutoAccuracy(data)[1] * 1000) / 10 + '%' + : '0%', + color: '', + }, + coralL1Auto: { + data: Math.round(averageCoralL1Auto(data) * 100) / 100, + color: '', + }, + coralL2Auto: { + data: Math.round(averageCoralL2Auto(data) * 100) / 100, + color: '', + }, + coralL3Auto: { + data: Math.round(averageCoralL3Auto(data) * 100) / 100, + color: '', + }, + coralL4Auto: { + data: Math.round(averageCoralL4Auto(data) * 100) / 100, + color: '', + }, + coralL1AutoAccData: coralL1AutoAccuracy(data), + coralL1AutoAcc: { + data: !isNaN(+coralL1AutoAccuracy(data)[1]) + ? Math.round(+coralL1AutoAccuracy(data)[1] * 1000) / 10 + '%' + : '0%', + color: '', + }, + coralL2AutoAccData: coralL2AutoAccuracy(data), + coralL2AutoAcc: { + data: !isNaN(+coralL2AutoAccuracy(data)[1]) + ? Math.round(+coralL2AutoAccuracy(data)[1] * 1000) / 10 + '%' + : '0%', + color: '', + }, + coralL3AutoAccData: coralL3AutoAccuracy(data), + coralL3AutoAcc: { + data: !isNaN(+coralL3AutoAccuracy(data)[1]) + ? Math.round(+coralL3AutoAccuracy(data)[1] * 1000) / 10 + '%' + : '0%', + color: '', + }, + coralL4AutoAccData: coralL4AutoAccuracy(data), + coralL4AutoAcc: { + data: !isNaN(+coralL4AutoAccuracy(data)[1]) + ? Math.round(+coralL4AutoAccuracy(data)[1] * 1000) / 10 + '%' + : '0%', color: '', }, autoAccData: autoAccuracy(data), @@ -197,12 +263,28 @@ async function tableSetup() { : '0%', color: '', }, - teleAmp: { - data: Math.round(getAverageAmpCycles(data) * 100) / 100, + teleProcessor: { + data: Math.round(getAverageProcessorCycles(data) * 100) / 100, + color: '', + }, + teleNet: { + data: Math.round(getAverageNetCycles(data) * 100) / 100, + color: '', + }, + teleCoralL1: { + data: Math.round(getAverageCoralL1Cycles(data) * 100) / 100, color: '', }, - teleSpeaker: { - data: Math.round(getAverageSpeakerCycles(data) * 100) / 100, + teleCoralL2: { + data: Math.round(getAverageCoralL2Cycles(data) * 100) / 100, + color: '', + }, + teleCoralL3: { + data: Math.round(getAverageCoralL3Cycles(data) * 100) / 100, + color: '', + }, + teleCoralL4: { + data: Math.round(getAverageCoralL4Cycles(data) * 100) / 100, color: '', }, teleAccData: teleAccuracy(data), @@ -212,10 +294,6 @@ async function tableSetup() { : '0%', color: '', }, - traps: { - data: Math.round(getAverageTraps(data) * 100) / 100, - color: '', - }, endgamePoints: { data: Math.round(endgamePoints(data) * 100) / 100, color: '', @@ -238,17 +316,26 @@ async function tableSetup() { } teamsData.value = sortedData; } - /* averages if i ever need + /*// averages if i ever need let averages = { driver: 0, defense: 0, - ampAuto: 0, - speakerAuto: 0, + netAuto: 0, + netAutoAcc: 0, + processorAuto: 0, + processorAutoAcc: 0, + coralL1Auto: 0, + coralL2Auto: 0, + coralL3Auto: 0, + coralL4Auto: 0, autoAcc: 0, - teleAmp: 0, - teleSpeaker: 0, + teleProcessor: 0, + teleNet: 0, + teleCoralL1: 0, + teleCoralL2: 0, + teleCoralL3: 0, + teleCoralL4: 0, teleAcc: 0, - traps: 0, endgamePoints: 0, } @@ -257,49 +344,89 @@ async function tableSetup() { let totalMatches = team.rawData.length averages.driver += team.driver.data * totalMatches averages.defense += team.defense.data * totalMatches - averages.ampAuto += team.ampAuto.data * totalMatches - averages.speakerAuto += team.speakerAuto.data * totalMatches + averages.netAuto += team.netAuto.data * totalMatches + averages.processorAuto += team.processorAuto.data * totalMatches + averages.coralL1Auto += team.coralL1Auto.data * totalMatches + averages.coralL2Auto += team.coralL2Auto.data * totalMatches + averages.coralL3Auto += team.coralL3Auto.data * totalMatches + averages.coralL4Auto += team.coralL4Auto.data * totalMatches averages.autoAcc += Number(team.autoAcc.data.replace('%', '')) * totalMatches - averages.teleAmp += team.teleAmp.data * totalMatches - averages.teleSpeaker += team.teleSpeaker.data * totalMatches + averages.teleProcessor += team.teleProcessor.data * totalMatches + averages.teleNet += team.teleNet.data * totalMatches + averages.teleCoralL1 += team.teleCoralL1 * totalMatches + averages.teleCoralL2 += team.teleCoralL2 * totalMatches + averages.teleCoralL3 += team.teleCoralL3 * totalMatches + averages.teleCoralL4 += team.teleCoralL4 * totalMatches averages.teleAcc += Number(team.teleAcc.data.replace('%', '')) * totalMatches - averages.traps += team.traps.data * totalMatches averages.endgamePoints += team.endgamePoints.data * totalMatches weight += totalMatches } averages.driver /= weight averages.defense /= weight - averages.ampAuto /= weight - averages.speakerAuto /= weight + averages.netAuto /= weight + averages.processorAuto /= weight + averages.coralL1Auto /= weight + averages.coralL2Auto /= weight + averages.coralL3Auto /= weight + averages.coralL4Auto /= weight averages.autoAcc /= weight - averages.teleAmp /= weight - averages.teleSpeaker /= weight + averages.teleProcessor /= weight + averages.teleNet /= weight + averages.teleCoralL1 /= weight + averages.teleCoralL2 /= weight + averages.teleCoralL3 /= weight + averages.teleCoralL4 /= weight averages.teleAcc /= weight - averages.traps /= weight averages.endgamePoints /= weight */ let data: { driver: number[]; defense: number[]; - ampAuto: number[]; - speakerAuto: number[]; + netAuto: number[]; + netAutoAcc: number[]; + processorAuto: number[]; + processorAutoAcc: number[]; + coralL1Auto: number[]; + coralL2Auto: number[]; + coralL3Auto: number[]; + coralL4Auto: number[]; + coralL1AutoAcc: number[]; + coralL2AutoAcc: number[]; + coralL3AutoAcc: number[]; + coralL4AutoAcc: number[]; autoAcc: number[]; - teleAmp: number[]; - teleSpeaker: number[]; + teleProcessor: number[]; + teleNet: number[]; + teleCoralL1: number[]; + teleCoralL2: number[]; + teleCoralL3: number[]; + teleCoralL4: number[]; teleAcc: number[]; - traps: number[]; endgamePoints: number[]; } = { driver: [], defense: [], - ampAuto: [], - speakerAuto: [], + netAuto: [], + netAutoAcc: [], + processorAuto: [], + processorAutoAcc: [], + coralL1Auto: [], + coralL2Auto: [], + coralL3Auto: [], + coralL4Auto: [], + coralL1AutoAcc: [], + coralL2AutoAcc: [], + coralL3AutoAcc: [], + coralL4AutoAcc: [], autoAcc: [], - teleAmp: [], - teleSpeaker: [], + teleProcessor: [], + teleNet: [], + teleCoralL1: [], + teleCoralL2: [], + teleCoralL3: [], + teleCoralL4: [], teleAcc: [], - traps: [], endgamePoints: [], }; for (let team of teamsData.value) { @@ -308,13 +435,26 @@ async function tableSetup() { if (team.defense.data != 0) data.defense.push(Number(team.defense.data)); else if (!data.defense.includes(0)) data.defense.push(0); - data.ampAuto.push(Number(team.ampAuto.data)); - data.speakerAuto.push(Number(team.speakerAuto.data)); + data.netAuto.push(Number(team.netAuto.data)); + data.netAutoAcc.push(Number(team.netAutoAcc.data.replace('%', ''))); + data.processorAuto.push(Number(team.processorAuto.data)); + data.processorAutoAcc.push(Number(team.processorAutoAcc.data.replace('%', ''))); + data.coralL1Auto.push(Number(team.coralL1Auto.data)); + data.coralL2Auto.push(Number(team.coralL2Auto.data)); + data.coralL3Auto.push(Number(team.coralL3Auto.data)); + data.coralL4Auto.push(Number(team.coralL4Auto.data)); + data.coralL1AutoAcc.push(Number(team.coralL1AutoAcc.data.replace('%', ''))); + data.coralL2AutoAcc.push(Number(team.coralL2AutoAcc.data.replace('%', ''))); + data.coralL3AutoAcc.push(Number(team.coralL3AutoAcc.data.replace('%', ''))); + data.coralL4AutoAcc.push(Number(team.coralL4AutoAcc.data.replace('%', ''))); data.autoAcc.push(Number(team.autoAcc.data.replace('%', ''))); - data.teleAmp.push(Number(team.teleAmp.data)); - data.teleSpeaker.push(Number(team.teleSpeaker.data)); + data.teleProcessor.push(Number(team.teleProcessor.data)); + data.teleNet.push(Number(team.teleNet.data)); + data.teleCoralL1.push(Number(team.teleCoralL1.data)); + data.teleCoralL2.push(Number(team.teleCoralL2.data)); + data.teleCoralL3.push(Number(team.teleCoralL3.data)); + data.teleCoralL4.push(Number(team.teleCoralL4.data)); data.teleAcc.push(Number(team.teleAcc.data.replace('%', ''))); - data.traps.push(Number(team.traps.data)); data.endgamePoints.push(Number(team.endgamePoints.data)); } let teamPercents = []; @@ -343,18 +483,46 @@ async function tableSetup() { Math.max(...data.defense), ), ); - teamsData.value[i].ampAuto.color = colorify( + teamsData.value[i].netAuto.color = colorify( + calculatePercent( + teamsData.value[i].netAuto.data, + Math.min(...data.netAuto), + Math.max(...data.netAuto), + ), + ); + teamsData.value[i].processorAuto.color = colorify( calculatePercent( - teamsData.value[i].ampAuto.data, - Math.min(...data.ampAuto), - Math.max(...data.ampAuto), + teamsData.value[i].processorAuto.data, + Math.min(...data.processorAuto), + Math.max(...data.processorAuto), ), ); - teamsData.value[i].speakerAuto.color = colorify( + teamsData.value[i].coralL1Auto.color = colorify( calculatePercent( - teamsData.value[i].speakerAuto.data, - Math.min(...data.speakerAuto), - Math.max(...data.speakerAuto), + teamsData.value[i].coralL1Auto.data, + Math.min(...data.coralL1Auto), + Math.max(...data.coralL1Auto), + ), + ); + teamsData.value[i].coralL2Auto.color = colorify( + calculatePercent( + teamsData.value[i].coralL2Auto.data, + Math.min(...data.coralL2Auto), + Math.max(...data.coralL2Auto), + ), + ); + teamsData.value[i].coralL3Auto.color = colorify( + calculatePercent( + teamsData.value[i].coralL3Auto.data, + Math.min(...data.coralL3Auto), + Math.max(...data.coralL3Auto), + ), + ); + teamsData.value[i].coralL4Auto.color = colorify( + calculatePercent( + teamsData.value[i].coralL4Auto.data, + Math.min(...data.coralL4Auto), + Math.max(...data.coralL4Auto), ), ); teamsData.value[i].autoAcc.color = colorify( @@ -364,18 +532,46 @@ async function tableSetup() { Math.max(...data.autoAcc), ), ); - teamsData.value[i].teleAmp.color = colorify( + teamsData.value[i].teleProcessor.color = colorify( + calculatePercent( + teamsData.value[i].teleProcessor.data, + Math.min(...data.teleProcessor), + Math.max(...data.teleProcessor), + ), + ); + teamsData.value[i].teleNet.color = colorify( + calculatePercent( + teamsData.value[i].teleNet.data, + Math.min(...data.teleNet), + Math.max(...data.teleNet), + ), + ); + teamsData.value[i].teleCoralL1.color = colorify( calculatePercent( - teamsData.value[i].teleAmp.data, - Math.min(...data.teleAmp), - Math.max(...data.teleAmp), + teamsData.value[i].teleCoralL1.data, + Math.min(...data.teleCoralL1), + Math.max(...data.teleCoralL1), ), ); - teamsData.value[i].teleSpeaker.color = colorify( + teamsData.value[i].teleCoralL2.color = colorify( calculatePercent( - teamsData.value[i].teleSpeaker.data, - Math.min(...data.teleSpeaker), - Math.max(...data.teleSpeaker), + teamsData.value[i].teleCoralL2.data, + Math.min(...data.teleCoralL3), + Math.max(...data.teleCoralL3), + ), + ); + teamsData.value[i].teleCoralL3.color = colorify( + calculatePercent( + teamsData.value[i].teleCoralL3.data, + Math.min(...data.teleCoralL3), + Math.max(...data.teleCoralL3), + ), + ); + teamsData.value[i].teleCoralL4.color = colorify( + calculatePercent( + teamsData.value[i].teleCoralL4.data, + Math.min(...data.teleCoralL4), + Math.max(...data.teleCoralL4), ), ); teamsData.value[i].teleAcc.color = colorify( @@ -385,13 +581,6 @@ async function tableSetup() { Math.max(...data.teleAcc), ), ); - teamsData.value[i].traps.color = colorify( - calculatePercent( - teamsData.value[i].traps.data, - Math.min(...data.traps), - Math.max(...data.traps), - ), - ); teamsData.value[i].endgamePoints.color = colorify( calculatePercent( teamsData.value[i].endgamePoints.data, @@ -406,6 +595,7 @@ async function tableSetup() { ); } +//TODO: talk to ryan or preston about math here function colorifyTeam(teamData: TeamTableData, data: DataArrayOrSum) { let totalPercent = 0; if (teamData.driver.data != 0) { @@ -413,14 +603,14 @@ function colorifyTeam(teamData: TeamTableData, data: DataArrayOrSum) { teamData.driver.data, Math.min(...data.driver), Math.max(...data.driver), - ); + ) ; } else { totalPercent += calculatePercent( average(data.driver), Math.min(...data.driver), Math.max(...data.driver), - ) * 0.66; + ); } if (teamData.defense.data != 0) { totalPercent += @@ -428,48 +618,87 @@ function colorifyTeam(teamData: TeamTableData, data: DataArrayOrSum) { teamData.defense.data, Math.min(...data.defense), Math.max(...data.defense), - ) * 0.33; + ); } else { totalPercent += calculatePercent( average(data.defense), Math.min(...data.defense), Math.max(...data.defense), - ) * 0.33; + ); } totalPercent += calculatePercent( - teamData.ampAuto.data, - Math.min(...data.ampAuto), - Math.max(...data.ampAuto), - (totalPercent += calculatePercent( - teamData.speakerAuto.data, - Math.min(...data.speakerAuto), - Math.max(...data.speakerAuto), - )), + teamData.netAuto.data, + Math.min(...data.netAuto), + Math.max(...data.netAuto), ); + totalPercent += calculatePercent( + teamData.processorAuto.data, + Math.min(...data.processorAuto), + Math.max(...data.processorAuto), + ); + totalPercent += calculatePercent( + teamData.coralL1Auto.data, + Math.min(...data.coralL1Auto), + Math.max(...data.coralL1Auto), + ); + totalPercent += calculatePercent( + teamData.coralL2Auto.data, + Math.min(...data.coralL2Auto), + Math.max(...data.coralL2Auto), + ); + totalPercent += calculatePercent( + teamData.coralL3Auto.data, + Math.min(...data.coralL3Auto), + Math.max(...data.coralL3Auto), + ); + totalPercent += calculatePercent( + teamData.coralL4Auto.data, + Math.min(...data.coralL4Auto), + Math.max(...data.coralL4Auto), + ); + totalPercent += calculatePercent( + Number(teamData.autoAcc.data.replace('%', '')), + Math.min(...data.autoAcc), + Math.max(...data.autoAcc), + ); totalPercent += calculatePercent( - Number(teamData.autoAcc.data.replace('%', '')), - Math.min(...data.autoAcc), - Math.max(...data.autoAcc), - ) * 0.5; - totalPercent += - calculatePercent( - teamData.teleAmp.data, - Math.min(...data.teleAmp), - Math.max(...data.teleAmp), - ) * 0.8; + teamData.teleProcessor.data, + Math.min(...data.teleProcessor), + Math.max(...data.teleProcessor), + ); totalPercent += calculatePercent( - teamData.teleSpeaker.data, - Math.min(...data.teleSpeaker), - Math.max(...data.teleSpeaker), + teamData.teleNet.data, + Math.min(...data.teleNet), + Math.max(...data.teleNet), + ); + totalPercent += calculatePercent( + teamData.teleCoralL1.data, + Math.min(...data.teleCoralL1), + Math.max(...data.teleCoralL1), + ); + totalPercent += calculatePercent( + teamData.teleCoralL2.data, + Math.min(...data.teleCoralL2), + Math.max(...data.teleCoralL2), + ); + totalPercent += calculatePercent( + teamData.teleCoralL3.data, + Math.min(...data.teleCoralL3), + Math.max(...data.teleCoralL3), + ); + totalPercent += calculatePercent( + teamData.teleCoralL4.data, + Math.min(...data.teleCoralL4), + Math.max(...data.teleCoralL4), ); totalPercent += calculatePercent( Number(teamData.teleAcc.data.replace('%', '')), Math.min(...data.teleAcc), Math.max(...data.teleAcc), - ) * 0.5; + ); totalPercent += calculatePercent( teamData.endgamePoints.data, Math.min(...data.endgamePoints), @@ -522,38 +751,103 @@ function averageDriverScore(teamArrays: Array) { return totalMatches != 0 ? total / totalMatches : 0; } -function averageAmpsAuto(teamArrays: Array) { +function averageNetAuto(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].auto.net; + } + return nonAveragedValue / teamArrays.length; +} + +function averageProcessorAuto(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].auto.processor; + } + return nonAveragedValue / teamArrays.length; +} + +function averageCoralL1Auto(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].auto.coralL1; + } + return nonAveragedValue / teamArrays.length; +} + +function averageCoralL2Auto(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].auto.coralL2; + } + return nonAveragedValue / teamArrays.length; +} + +function averageCoralL3Auto(teamArrays: Array) { let nonAveragedValue = 0; for (let i = 0; i < teamArrays.length; i++) { - nonAveragedValue += teamArrays[i].auto.amp; + nonAveragedValue += teamArrays[i].auto.coralL3; } return nonAveragedValue / teamArrays.length; } -function averageSpeakersAuto(teamArrays: Array) { +function averageCoralL4Auto(teamArrays: Array) { let nonAveragedValue = 0; for (let i = 0; i < teamArrays.length; i++) { - nonAveragedValue += teamArrays[i].auto.speakerNA; + nonAveragedValue += teamArrays[i].auto.coralL4; } return nonAveragedValue / teamArrays.length; } -function getAverageSpeakerCycles(teamArrays: Array) { +function getAverageNetCycles(teamArrays: Array) { let nonAveragedValue = 0; for (let i = 0; i < teamArrays.length; i++) { - nonAveragedValue += teamArrays[i].teleop.speakerNA; + nonAveragedValue += teamArrays[i].teleop.net; } return nonAveragedValue / teamArrays.length; } -function getAverageAmpCycles(teamArrays: Array) { +function getAverageProcessorCycles(teamArrays: Array) { let nonAveragedValue = 0; for (let i = 0; i < teamArrays.length; i++) { - nonAveragedValue += teamArrays[i].teleop.amp; + nonAveragedValue += teamArrays[i].teleop.processor; } return nonAveragedValue / teamArrays.length; } +function getAverageCoralL1Cycles(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].teleop.coralL1; + } + return nonAveragedValue / teamArrays.length; +} + +function getAverageCoralL2Cycles(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].teleop.coralL2; + } + return nonAveragedValue / teamArrays.length; +} + +function getAverageCoralL3Cycles(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].teleop.coralL3; + } + return nonAveragedValue / teamArrays.length; +} + +function getAverageCoralL4Cycles(teamArrays: Array) { + let nonAveragedValue = 0; + for (let i = 0; i < teamArrays.length; i++) { + nonAveragedValue += teamArrays[i].teleop.coralL4; + } + return nonAveragedValue / teamArrays.length; +} + + function averageAuto(teamArrays: Array): number { let successfulMobilityCount = 0; for (let match of teamArrays) { @@ -562,97 +856,323 @@ function averageAuto(teamArrays: Array): number { return successfulMobilityCount / teamArrays.length; } -function autoAccuracy(teamArrays: Array) { - let successfulAmpCount = 0; - let successfulSpeakerCount = 0; - let missedAmpCount = 0; - let missedSpeakerCount = 0; +function netAutoAccuracy(teamArrays: Array) { + let successfulNetCount = 0; + let missedNetCount = 0; let newData = false; for (let match of teamArrays) { - successfulAmpCount += match.auto.amp; - successfulSpeakerCount += match.auto.speakerNA; - if (match.auto.missedAmp != undefined) { - missedAmpCount += match.auto.missedAmp; - missedSpeakerCount += match.auto.missedSpeaker; + successfulNetCount += match.auto.net; + if (match.auto.netMiss != undefined) { + missedNetCount += match.auto.netMiss; newData = true; } else { - missedAmpCount += match.auto.missedAmp; + missedNetCount += match.auto.netMiss; } } if (newData) return [ true, - (successfulAmpCount + successfulSpeakerCount) / - (missedAmpCount + - missedSpeakerCount + - successfulSpeakerCount + - successfulAmpCount), - successfulAmpCount / (missedAmpCount + successfulAmpCount), - successfulSpeakerCount / (missedSpeakerCount + successfulSpeakerCount), + (successfulNetCount) / + (missedNetCount + successfulNetCount), ]; else return [ false, - (successfulAmpCount + successfulSpeakerCount) / - (missedAmpCount + successfulSpeakerCount + successfulAmpCount), + (successfulNetCount) / + (successfulNetCount), ]; } -function teleAccuracy(teamArrays: Array) { - let successfulAmpCount = 0; - let successfulSpeakerCount = 0; - let missedAmpCount = 0; - let missedSpeakerCount = 0; +function processorAutoAccuracy(teamArrays: Array) { + let successfulProcessorCount = 0; + let missedProcessorCount = 0; let newData = false; for (let match of teamArrays) { - successfulAmpCount += match.teleop.amp; - successfulSpeakerCount += match.teleop.speakerNA; - if (match.teleop.missedAmp != undefined) { - missedAmpCount += match.teleop.missedAmp; - missedSpeakerCount += match.teleop.missedSpeaker; + successfulProcessorCount += match.auto.processor; + if (match.auto.processorMiss != undefined) { + missedProcessorCount += match.auto.processorMiss; newData = true; - } else { - missedAmpCount += match.teleop.missedAmp; + } + else { + missedProcessorCount += match.auto.processorMiss; + } + } + if (newData) + return [ + true, + (successfulProcessorCount) / + (missedProcessorCount + successfulProcessorCount), + ]; + else + return [ + false, + (successfulProcessorCount) / + (successfulProcessorCount), + ]; +} + +function coralL1AutoAccuracy(teamArrays: Array) { + let successfulCoralCount = 0; + let missedCoralCount = 0; + let newData = false; + for (let match of teamArrays) { + successfulCoralCount += match.auto.coralL1; + if (match.auto.coralL1Miss != undefined) { + missedCoralCount += match.auto.coralL1Miss; + newData = true; + } + else { + missedCoralCount += match.auto.coralL1Miss; + } + } + if (newData) + return [ + true, + (successfulCoralCount) / + (missedCoralCount + successfulCoralCount), + ]; + else + return [ + false, + (successfulCoralCount) / + (successfulCoralCount), + ]; +} + +function coralL2AutoAccuracy(teamArrays: Array) { + let successfulCoralCount = 0; + let missedCoralCount = 0; + let newData = false; + for (let match of teamArrays) { + successfulCoralCount += match.auto.coralL2; + if (match.auto.coralL2Miss != undefined) { + missedCoralCount += match.auto.coralL2Miss; + newData = true; + } + else { + missedCoralCount += match.auto.coralL2Miss; + } + } + if (newData) + return [ + true, + (successfulCoralCount) / + (missedCoralCount + successfulCoralCount), + ]; + else + return [ + false, + (successfulCoralCount) / + (successfulCoralCount), + ]; +} + +function coralL3AutoAccuracy(teamArrays: Array) { + let successfulCoralCount = 0; + let missedCoralCount = 0; + let newData = false; + for (let match of teamArrays) { + successfulCoralCount += match.auto.coralL3; + if (match.auto.coralL3Miss != undefined) { + missedCoralCount += match.auto.coralL3Miss; + newData = true; + } + else { + missedCoralCount += match.auto.coralL3Miss; } } if (newData) return [ true, - (successfulAmpCount + successfulSpeakerCount) / - (missedAmpCount + - missedSpeakerCount + - successfulSpeakerCount + - successfulAmpCount), - successfulAmpCount / (missedAmpCount + successfulAmpCount), - successfulSpeakerCount / (missedSpeakerCount + successfulSpeakerCount), + (successfulCoralCount) / + (missedCoralCount + successfulCoralCount), ]; else return [ false, - (successfulAmpCount + successfulSpeakerCount) / - (missedAmpCount + successfulSpeakerCount + successfulAmpCount), + (successfulCoralCount) / + (successfulCoralCount), ]; } -function getAverageTraps(teamArrays: Array): number { - let totalTraps = 0; +function reefAutoAccuracy(teamArrays: Array) { + let successfulCoralCount = 0; + let missedCoralCount = 0; + let newData = false; for (let match of teamArrays) { - totalTraps += match.endgame.trap; + successfulCoralCount += (match.auto.coralL1 + match.auto.coralL2 + match.auto.coralL3 + match.auto.coralL4); + if ((match.auto.coralL1Miss + match.auto.coralL2Miss + match.auto.coralL3Miss + match.auto.coralL4Miss) != undefined) { + missedCoralCount += (match.auto.coralL1Miss + match.auto.coralL2Miss + match.auto.coralL3Miss + match.auto.coralL4Miss); + newData = true; + } + else { + missedCoralCount += (match.auto.coralL1Miss + match.auto.coralL2Miss + match.auto.coralL3Miss + match.auto.coralL4Miss); + } } - return totalTraps / teamArrays.length; + if (newData) + return [ + true, + (successfulCoralCount) / + (missedCoralCount + successfulCoralCount), + ]; + else + return [ + false, + (successfulCoralCount) / + (successfulCoralCount), + ]; } +function coralL4AutoAccuracy(teamArrays: Array) { + let successfulCoralCount = 0; + let missedCoralCount = 0; + let newData = false; + for (let match of teamArrays) { + successfulCoralCount += match.auto.coralL4; + if (match.auto.coralL4Miss != undefined) { + missedCoralCount += match.auto.coralL4Miss; + newData = true; + } + else { + missedCoralCount += match.auto.coralL4Miss; + } + } + if (newData) + return [ + true, + (successfulCoralCount) / + (missedCoralCount + successfulCoralCount), + ]; + else + return [ + false, + (successfulCoralCount) / + (successfulCoralCount), + ]; +} + +function autoAccuracy(teamArrays: Array) { + let successfulNetCount = 0; + let successfulProcessorCount = 0; + let successfulCoralL1Count = 0; + let successfulCoralL2Count = 0; + let successfulCoralL3Count = 0; + let successfulCoralL4Count = 0; + let successfulReefCount = 0; + let missedNetCount = 0; + let missedProcessorCount = 0; + let missedCoralL1Count = 0; + let missedCoralL2Count = 0; + let missedCoralL3Count = 0; + let missedCoralL4Count = 0; + let missedReefCount = 0; + let newData = false; + for (let match of teamArrays) { + successfulNetCount += match.auto.net; + successfulProcessorCount += match.auto.processor; + successfulCoralL1Count += match.auto.coralL1; + successfulCoralL2Count += match.auto.coralL2; + successfulCoralL3Count += match.auto.coralL3; + successfulCoralL4Count += match.auto.coralL4; + successfulReefCount += match.auto.coralL1 + match.auto.coralL2 + match.auto.coralL3 + match.auto.coralL4; + if (match.auto.netMiss != undefined) { + missedNetCount += match.auto.netMiss; + missedProcessorCount += match.auto.processorMiss; + missedCoralL1Count += match.auto.coralL1Miss; + missedCoralL2Count += match.auto.coralL2Miss; + missedCoralL3Count += match.auto.coralL3Miss; + missedCoralL4Count += match.auto.coralL4Miss; + missedReefCount += match.auto.coralL1Miss + match.auto.coralL2Miss + match.auto.coralL3Miss + match.auto.coralL4Miss; + //TODO: talk about adding coral misses to scouting and then put them here + newData = true; + } else { + missedNetCount += match.auto.netMiss; + } + } + //TODO: reef accuracy here + if (newData) + return [ + true, + (successfulNetCount + successfulProcessorCount + successfulReefCount) / + (missedNetCount + missedProcessorCount + successfulProcessorCount + successfulNetCount + successfulReefCount + missedReefCount), + successfulNetCount / (missedNetCount + successfulNetCount), + successfulProcessorCount / (missedProcessorCount + successfulProcessorCount), + successfulReefCount / (missedReefCount + successfulReefCount), + ]; + else + return [ + false, + (successfulNetCount + successfulReefCount + successfulProcessorCount) / + (missedProcessorCount + successfulProcessorCount + successfulNetCount + missedReefCount + successfulReefCount), + ]; +} + +function teleAccuracy(teamArrays: Array) { + let successfulNetCount = 0; + let successfulProcessorCount = 0; + let successfulCoralL1Count = 0; + let successfulCoralL2Count = 0; + let successfulCoralL3Count = 0; + let successfulCoralL4Count = 0; + let successfulReefCount = 0; + let missedNetCount = 0; + let missedProcessorCount = 0; + let missedCoralL1Count = 0; + let missedCoralL2Count = 0; + let missedCoralL3Count = 0; + let missedCoralL4Count = 0; + let missedReefCount = 0; + let newData = false; + for (let match of teamArrays) { + successfulNetCount += match.teleop.net; + successfulProcessorCount += match.teleop.processor; + successfulCoralL1Count += match.teleop.coralL1; + successfulCoralL2Count += match.teleop.coralL2; + successfulCoralL3Count += match.teleop.coralL3; + successfulCoralL4Count += match.teleop.coralL4; + successfulReefCount += match.teleop.coralL1 + match.teleop.coralL2 + match.teleop.coralL3 + match.teleop.coralL4; + if (match.teleop.processorMiss != undefined) { + //TODO: talk about adding coral misses to scouting and then put them here + missedNetCount += match.teleop.netMiss; + missedProcessorCount += match.teleop.processorMiss; + missedCoralL1Count += match.teleop.coralL1Miss; + missedCoralL2Count += match.teleop.coralL2Miss; + missedCoralL3Count += match.teleop.coralL3Miss; + missedCoralL4Count += match.teleop.coralL4Miss; + missedReefCount += match.teleop.coralL1Miss + match.teleop.coralL2Miss + match.teleop.coralL3Miss + match.teleop.coralL4Miss; + + newData = true; + } else { + missedProcessorCount += match.teleop.processorMiss; + } + } + //TODO: reef accuracy here + if (newData) + return [ + true, + (successfulNetCount + successfulProcessorCount + successfulReefCount) / + (missedNetCount + missedProcessorCount + successfulProcessorCount + successfulNetCount + successfulReefCount + missedReefCount), + successfulNetCount / (missedNetCount + successfulNetCount), + successfulProcessorCount / (missedProcessorCount + successfulProcessorCount), + successfulReefCount / (missedReefCount + successfulReefCount), + ]; + else + return [ + false, + (successfulNetCount + successfulReefCount + successfulProcessorCount) / + (missedProcessorCount + successfulProcessorCount + successfulNetCount + successfulReefCount + missedReefCount), + ]; +} function endgamePoints(teamArrays: Array): number { let totalEndgamePoints = 0; for (let event of teamArrays) { - if (event.endgame.endgame.includes('Harmony')) totalEndgamePoints += 5; - else if (event.endgame.endgame.includes('Onstage')) totalEndgamePoints += 3; + if (event.endgame.endgame.includes('Deep Successful')) totalEndgamePoints += 12; + else if (event.endgame.endgame.includes('Shallow Successful')) totalEndgamePoints += 6; else if ( - event.endgame.endgame.includes('Attempted Onstage') || - event.endgame.endgame.includes('Parked') + event.endgame.endgame.includes('Deep Attempted') || + event.endgame.endgame.includes('Parked') || event.endgame.endgame.includes('Shallow Attempted') ) - totalEndgamePoints += 1; - totalEndgamePoints += event.endgame.trap * 5; + totalEndgamePoints += 2; } return totalEndgamePoints / teamArrays.length; } @@ -703,31 +1223,44 @@ let columns = ref([ icon: 'i-heroicons-arrows-up-down', }, { - label: 'Amps', + label: 'Net', sort: 'none', sortable: true, icon: 'i-heroicons-arrows-up-down', }, { - label: 'Speakers', + label: 'Processor', sort: 'none', sortable: true, icon: 'i-heroicons-arrows-up-down', }, + /* { - label: 'Accuracy', + label: 'Reef', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + },*/ + { + label: 'Coral L1', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + }, + { + label: 'Coral L2', sort: 'none', sortable: true, icon: 'i-heroicons-arrows-up-down', }, { - label: 'Amps', + label: 'Coral L3', sort: 'none', sortable: true, icon: 'i-heroicons-arrows-up-down', }, { - label: 'Speakers', + label: 'Coral L4', sort: 'none', sortable: true, icon: 'i-heroicons-arrows-up-down', @@ -739,13 +1272,49 @@ let columns = ref([ icon: 'i-heroicons-arrows-up-down', }, { - label: 'Points', + label: 'Net', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + }, + { + label: 'Processor', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + }, + { + label: 'Coral L1', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + }, + { + label: 'Coral L2', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + }, + { + label: 'Coral L3', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + }, + { + label: 'Coral L4', sort: 'none', sortable: true, icon: 'i-heroicons-arrows-up-down', }, { - label: 'Traps', + label: 'Accuracy', + sort: 'none', + sortable: true, + icon: 'i-heroicons-arrows-up-down', + }, + { + label: 'Points', sort: 'none', sortable: true, icon: 'i-heroicons-arrows-up-down', @@ -1017,29 +1586,29 @@ await tableSetup();
- + + + + + + + + + -
@@ -1048,21 +1617,21 @@ await tableSetup();

/5.00

Average

Auto Cycles

Average

Teleop Cycles

Average

@@ -1137,16 +1706,44 @@ await tableSetup();
+ + + + + + + + @@ -1165,7 +1762,7 @@ await tableSetup();
@@ -1174,7 +1771,7 @@ await tableSetup(); !isNaN(team.autoAccData[2]) ? Math.round(team.autoAccData[2] * 1000) / 10 + '%' - : '0%' + : 'N/A' " variant="soft" color="white" @@ -1182,7 +1779,7 @@ await tableSetup();
@@ -1191,7 +1788,24 @@ await tableSetup(); !isNaN(team.autoAccData[3]) ? Math.round(team.autoAccData[3] * 1000) / 10 + '%' - : '0%' + : 'N/A' + " + variant="soft" + color="white" + /> +
+
+ +
+ + + + + + + + @@ -1237,7 +1879,7 @@ await tableSetup();
@@ -1254,7 +1896,7 @@ await tableSetup();
@@ -1269,6 +1911,23 @@ await tableSetup(); color="white" />
+
+ + +
@@ -1286,13 +1945,6 @@ await tableSetup(); :color="team.endgamePoints.color" />
- -