Add support for entering eliminations matches on the scouting app
This patch plumbs through the "round" and "compLevel" fields where
necessary in order to let folks scout eliminations matches.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Idf20d77ed36b79f7dffb598f98e382260e6b81c9
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index c90e3d0..9637e8c 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -25,6 +25,19 @@
| 'Review and Submit'
| 'Success';
+// TODO(phil): Deduplicate with match_list.component.ts.
+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',
+};
+
@Component({
selector: 'app-entry',
templateUrl: './entry.ng.html',
@@ -34,11 +47,15 @@
// Re-export the type here so that we can use it in the `[value]` attribute
// of radio buttons.
readonly ClimbLevel = ClimbLevel;
+ readonly COMP_LEVELS = COMP_LEVELS;
+ readonly COMP_LEVEL_LABELS = COMP_LEVEL_LABELS;
section: Section = 'Team Selection';
@Output() switchTabsEvent = new EventEmitter<string>();
@Input() matchNumber: number = 1;
@Input() teamNumber: number = 1;
+ @Input() round: number = 1;
+ @Input() compLevel: CompLevel = 'qm';
autoUpperShotsMade: number = 0;
autoLowerShotsMade: number = 0;
autoShotsMissed: number = 0;
@@ -113,10 +130,13 @@
this.errorMessage = '';
const builder = new Builder();
+ const compLevel = builder.createString(this.compLevel);
const comment = builder.createString(this.comment);
SubmitDataScouting.startSubmitDataScouting(builder);
SubmitDataScouting.addTeam(builder, this.teamNumber);
SubmitDataScouting.addMatch(builder, this.matchNumber);
+ SubmitDataScouting.addRound(builder, this.round);
+ SubmitDataScouting.addCompLevel(builder, compLevel);
SubmitDataScouting.addMissedShotsAuto(builder, this.autoShotsMissed);
SubmitDataScouting.addUpperGoalAuto(builder, this.autoUpperShotsMade);
SubmitDataScouting.addLowerGoalAuto(builder, this.autoLowerShotsMade);
diff --git a/scouting/www/entry/entry.ng.html b/scouting/www/entry/entry.ng.html
index b8eaa78..46e5989 100644
--- a/scouting/www/entry/entry.ng.html
+++ b/scouting/www/entry/entry.ng.html
@@ -28,6 +28,18 @@
max="9999"
/>
</div>
+ <div class="row">
+ <label for="round">Round</label>
+ <input [(ngModel)]="round" type="number" id="round" min="1" max="10" />
+ </div>
+ <div class="row">
+ <label for="comp_level">Round</label>
+ <select [(ngModel)]="compLevel" type="number" id="comp_level">
+ <option *ngFor="let level of COMP_LEVELS" [ngValue]="level">
+ {{COMP_LEVEL_LABELS[level]}}
+ </option>
+ </select>
+ </div>
<div class="buttons">
<!-- hack to right align the next button -->
<div></div>
@@ -348,6 +360,8 @@
<ul>
<li>Match number: {{matchNumber}}</li>
<li>Team number: {{teamNumber}}</li>
+ <li>Round: {{round}}</li>
+ <li>Comp Level: {{COMP_LEVEL_LABELS[compLevel]}}</li>
</ul>
<h4>Auto</h4>
@@ -372,7 +386,7 @@
<h4>Climb</h4>
<ul>
- <li>Level: {{level | levelToString}}</li>
+ <li>Climb Level: {{level | levelToString}}</li>
<li>Comments: {{comment}}</li>
</ul>