Update Notes
Update Notes to include Match Number, Set Number, Comp Level, and No Show
Signed-off-by: Emily Markova <emily.markova@gmail.com>
Change-Id: I26550c0ea32b81bb8124d326cf1bef2bf912886a
diff --git a/scouting/www/notes/notes.component.ts b/scouting/www/notes/notes.component.ts
index 6263d37..5afc8e2 100644
--- a/scouting/www/notes/notes.component.ts
+++ b/scouting/www/notes/notes.component.ts
@@ -33,6 +33,18 @@
// for all the teams being scouted.
type Section = 'TeamSelection' | 'Data';
+const COMP_LEVELS = ['qm', 'ef', 'qf', 'sf', 'f'] as const;
+type CompLevel = typeof COMP_LEVELS[number];
+
+// TODO(phil): Deduplicate with match_list.component.ts.
+const COMP_LEVEL_LABELS: Record<CompLevel, string> = {
+ qm: 'Qualifications',
+ ef: 'Eighth Finals',
+ qf: 'Quarter Finals',
+ sf: 'Semi Finals',
+ f: 'Finals',
+};
+
// Every keyword checkbox corresponds to a boolean.
// If the boolean is True, the checkbox is selected
// and the note scout saw that the robot being scouted
@@ -45,12 +57,16 @@
goodDefense: boolean;
badDefense: boolean;
easilyDefended: boolean;
+ noShow: boolean;
}
interface Input {
teamNumber: string;
notesData: string;
keywordsData: Keywords;
+ matchNumber: number;
+ setNumber: number;
+ compLevel: string;
}
const KEYWORD_CHECKBOX_LABELS = {
@@ -61,6 +77,7 @@
goodDefense: 'Good Defense',
badDefense: 'Bad Defense',
easilyDefended: 'Easily Defended',
+ noShow: 'No Show',
} as const;
@Component({
@@ -71,6 +88,8 @@
export class Notes {
// Re-export KEYWORD_CHECKBOX_LABELS so that we can
// use it in the checkbox properties.
+ readonly COMP_LEVELS = COMP_LEVELS;
+ readonly COMP_LEVEL_LABELS = COMP_LEVEL_LABELS;
readonly KEYWORD_CHECKBOX_LABELS = KEYWORD_CHECKBOX_LABELS;
// Necessary in order to iterate the keys of KEYWORD_CHECKBOX_LABELS.
@@ -79,7 +98,10 @@
section: Section = 'TeamSelection';
errorMessage = '';
- teamNumberSelection: string = '971';
+ teamNumber: string = '1';
+ matchNumber: number = 1;
+ setNumber: number = 1;
+ compLevel: CompLevel = 'qm';
// Data inputted by user is stored in this array.
// Includes the team number, notes, and keyword selection.
@@ -108,10 +130,17 @@
}
}
- setTeamNumber() {
+ setTeamData() {
let data: Input = {
- teamNumber: this.teamNumberSelection,
- notesData: 'Match: \nAuto: \nTeleop: \nEndgame: ',
+ teamNumber: this.teamNumber,
+ notesData:
+ 'Match ' +
+ this.matchNumber +
+ ' Set ' +
+ this.setNumber +
+ ' ' +
+ COMP_LEVEL_LABELS[this.compLevel] +
+ ' \nAuto: \nTeleop: \nEndgame: ',
keywordsData: {
goodDriving: false,
badDriving: false,
@@ -120,7 +149,11 @@
goodDefense: false,
badDefense: false,
easilyDefended: false,
+ noShow: false,
},
+ matchNumber: this.matchNumber,
+ setNumber: this.setNumber,
+ compLevel: this.compLevel,
};
this.newData.push(data);
@@ -146,6 +179,7 @@
const dataFb = builder.createString(this.newData[i].notesData);
const teamNumber = builder.createString(this.newData[i].teamNumber);
+ const compLevel = builder.createString(this.newData[i].compLevel);
builder.finish(
SubmitNotes.createSubmitNotes(
@@ -158,7 +192,11 @@
this.newData[i].keywordsData.sketchyPlacing,
this.newData[i].keywordsData.goodDefense,
this.newData[i].keywordsData.badDefense,
- this.newData[i].keywordsData.easilyDefended
+ this.newData[i].keywordsData.easilyDefended,
+ this.newData[i].keywordsData.noShow,
+ this.newData[i].matchNumber,
+ this.newData[i].setNumber,
+ compLevel
)
);
diff --git a/scouting/www/notes/notes.ng.html b/scouting/www/notes/notes.ng.html
index d7262b3..7c5e48b 100644
--- a/scouting/www/notes/notes.ng.html
+++ b/scouting/www/notes/notes.ng.html
@@ -4,15 +4,41 @@
<ng-container [ngSwitch]="section">
<div *ngSwitchCase="'TeamSelection'">
- <label id="team_number_label" class="label" for="team_number_notes">
- Team Number
- </label>
- <input
- [(ngModel)]="teamNumberSelection"
- type="text"
- id="team_number_notes"
- />
- <button class="btn btn-primary" (click)="setTeamNumber()">Select</button>
+ <div class="row">
+ <label id="team_number_label" class="label" for="team_number_notes">
+ Team Number
+ </label>
+ <input [(ngModel)]="teamNumber" type="text" id="team_number_notes" />
+ </div>
+ <div class="row">
+ <label for="match_number_notes">Match Number</label>
+ <input
+ [(ngModel)]="matchNumber"
+ type="number"
+ id="match_number_notes"
+ min="1"
+ max="999"
+ />
+ </div>
+ <div class="row">
+ <label for="set_number_notes">Set Number</label>
+ <input
+ [(ngModel)]="setNumber"
+ type="number"
+ id="set_number_notes"
+ min="1"
+ max="10"
+ />
+ </div>
+ <div class="row">
+ <label for="comp_level_notes">Comp Level</label>
+ <select [(ngModel)]="compLevel" type="number" id="comp_level_notes">
+ <option *ngFor="let level of COMP_LEVELS" [ngValue]="level">
+ {{COMP_LEVEL_LABELS[level]}}
+ </option>
+ </select>
+ </div>
+ <button class="btn btn-primary" (click)="setTeamData()">Select</button>
</div>
<div *ngSwitchCase="'Data'">
@@ -74,7 +100,7 @@
<!--Row 2 (Prevent Overflow on mobile by splitting checkboxes into 2 rows)-->
<div class="d-flex flex-row justify-content-around">
<div
- *ngFor="let key of Object.keys(KEYWORD_CHECKBOX_LABELS) | slice:3:(Object.keys(KEYWORD_CHECKBOX_LABELS).length); let k = index"
+ *ngFor="let key of Object.keys(KEYWORD_CHECKBOX_LABELS) | slice:4:(Object.keys(KEYWORD_CHECKBOX_LABELS).length); let k = index"
>
<div class="form-check">
<input
diff --git a/scouting/www/view/view.component.ts b/scouting/www/view/view.component.ts
index 8aa3784..d88c25a 100644
--- a/scouting/www/view/view.component.ts
+++ b/scouting/www/view/view.component.ts
@@ -80,9 +80,7 @@
if (!this.ascendingSort) {
this.driverRankingList.sort((a, b) => b.matchNumber() - a.matchNumber());
this.noteList.sort(function (a, b) {
- return b[0]
- .team()
- .localeCompare(a[0].team(), undefined, {numeric: true});
+ return b.team().localeCompare(a.team(), undefined, {numeric: true});
});
this.pitImageList.sort(function (a, b) {
return b[0]
@@ -93,9 +91,7 @@
} else {
this.driverRankingList.sort((a, b) => a.matchNumber() - b.matchNumber());
this.noteList.sort(function (a, b) {
- return b[0]
- .team()
- .localeCompare(a[0].team(), undefined, {numeric: true});
+ return a.team().localeCompare(b.team(), undefined, {numeric: true});
});
this.pitImageList.sort(function (a, b) {
return a[0]
@@ -311,6 +307,9 @@
if (entry.badDriving()) {
parsedKeywords += 'Bad Driving ';
}
+ if (entry.noShow()) {
+ parsedKeywords += 'No Show ';
+ }
if (entry.solidPlacing()) {
parsedKeywords += 'Solid Placing ';
}
diff --git a/scouting/www/view/view.ng.html b/scouting/www/view/view.ng.html
index 14e8c8a..f870178 100644
--- a/scouting/www/view/view.ng.html
+++ b/scouting/www/view/view.ng.html
@@ -71,7 +71,7 @@
</div>
</th>
<th scope="col">Match</th>
- <th scope="col">Note</th>
+ <th scope="col">Notes</th>
<th scope="col">Keywords</th>
<th scope="col"></th>
</tr>
@@ -79,8 +79,7 @@
<tbody>
<tr *ngFor="let note of noteList; index as i;">
<th scope="row">{{note.team()}}</th>
- <!-- Placeholder for match number. -->
- <td>0</td>
+ <th scope="row">{{note.matchNumber()}}</th>
<td>{{note.notes()}}</td>
<td>{{parseKeywords(note)}}</td>
<!-- Delete Icon. -->