Skip to content

Commit

Permalink
added alliance colors and sorting to teams filters. also fixed a bug …
Browse files Browse the repository at this point in the history
…with trap incremental button that allowed it to go over 3
  • Loading branch information
Ryan-Bauroth committed Feb 16, 2024
1 parent 120aad4 commit db6db8c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pages/scout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ async function submit() {
</div>
<div>
<h1 class="text-green-600 font-sans">Trap</h1>
<IncrementalButton v-model="data.endgame.trap" style="margin:5px"></IncrementalButton>
<IncrementalButton v-model="data.endgame.trap" :max-value="3" style="margin:5px"></IncrementalButton>
</div>
</div>
<br>
Expand Down
20 changes: 19 additions & 1 deletion pages/teams.vue
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ async function tableSetup() {
*/
let allowedEvents = []
let allowedTeams = []
let blueAlliance = []
let redAlliance = []
for (let filter of selectedFilters.value) {
if (filter.content.startsWith("event:")) {
allowedEvents.push(filter.content.split(":")[1].trim())
Expand All @@ -106,12 +108,14 @@ async function tableSetup() {
let cleanedTeam = team.replace("frc", "")
if(!allowedTeams.includes(cleanedTeam)) {
allowedTeams.push(cleanedTeam)
blueAlliance.push(cleanedTeam)
}
}
for(let team of match.alliances.red.team_keys){
let cleanedTeam = team.replace("frc", "")
if(!allowedTeams.includes(cleanedTeam)) {
allowedTeams.push(cleanedTeam)
redAlliance.push(cleanedTeam)
}
}
}
Expand All @@ -124,6 +128,9 @@ async function tableSetup() {
Data is an array of all matches, associated with a team (key), for the event filters selected
*/
let data: any = []
//if sorted by match apply alliance colors
let alliance = blueAlliance.includes(key.toString()) ? "bg-blue-100": redAlliance.includes(key.toString()) ? "bg-red-100": ""
if (allowedTeams.includes(key.toString()) || allowedTeams.length == 0) {
for (let match of value) {
if (allowedEvents.includes(match.event)) {
Expand Down Expand Up @@ -169,11 +176,22 @@ async function tableSetup() {
speaker: getAverageSpeakerCycles(data).toFixed(2),
mobility: averageAuto(data).toFixed(2),
sentiment: analyzeNotes(data).toFixed(2),
endgame: compileEndgames(data)
endgame: compileEndgames(data),
class: alliance
}
teamsData.value.push(arr)
}
}
//Defaults to the alliance colors being together if match filter is selected
if(redAlliance.length > 0 || blueAlliance.length > 0){
let sortedData = []
for(let team of teamsData.value){
if(team.class == "bg-blue-100") sortedData.unshift(team)
else sortedData.push(team)
}
teamsData.value = sortedData
}
}
function analyzeNotes(teamArrays: Array<any>){
Expand Down

0 comments on commit db6db8c

Please sign in to comment.