scouting: Skip team selection after clicking on a team in the match list
It's not really useful to have the scouts go through the Team
Selection screen. The information is known to be correct. With this
patch, the user is automatically brought to the 'Init' screen when
they click on a team in the match list.
I also took this opportunity to clean up some stale signals/events
that weren't being used.
Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I2da4178465c217664c21251ffc1db46c42ca7445
diff --git a/scouting/scouting_test.cy.js b/scouting/scouting_test.cy.js
index d79bf5a..1d7620a 100644
--- a/scouting/scouting_test.cy.js
+++ b/scouting/scouting_test.cy.js
@@ -99,25 +99,24 @@
cy.get('.badge').eq(89).contains('Final 1 Match 3');
});
- it('should: prefill the match information.', () => {
- headerShouldBe('Matches');
-
- clickSemiFinal2Match3Team5254();
-
+ it('should: be let users enter match information manually.', () => {
+ switchToTab('Entry');
headerShouldBe(' Team Selection ');
- cy.get('#match_number').should('have.value', '3');
- cy.get('#team_number').should('have.value', '5254');
- cy.get('#set_number').should('have.value', '2');
- cy.get('#comp_level').should('have.value', '3: sf');
+
+ setInputTo('#match_number', '3');
+ setInputTo('#team_number', '5254');
+ setInputTo('#set_number', '2');
+ setInputTo('#comp_level', '3: sf');
+
+ clickButton('Next');
+
+ headerShouldBe('5254 Init ');
});
//TODO(FILIP): Verify last action when the last action header gets added.
it('should: be able to submit data scouting.', () => {
clickSemiFinal2Match3Team5254();
- headerShouldBe(' Team Selection ');
- clickButton('Next');
-
// Select Starting Position.
headerShouldBe('5254 Init ');
cy.get('[type="radio"]').first().check();
@@ -150,9 +149,6 @@
it('should: be able to return to correct screen with undo for pick and place.', () => {
clickSemiFinal2Match3Team5254();
- headerShouldBe(' Team Selection ');
- clickButton('Next');
-
// Select Starting Position.
cy.get('[type="radio"]').first().check();
clickButton('Start Match');
diff --git a/scouting/www/app/app.ng.html b/scouting/www/app/app.ng.html
index 526cd61..b7f1873 100644
--- a/scouting/www/app/app.ng.html
+++ b/scouting/www/app/app.ng.html
@@ -72,18 +72,15 @@
*ngSwitchCase="'MatchList'"
></app-match-list>
<app-entry
- (switchTabsEvent)="switchTabTo($event)"
[teamNumber]="selectedTeamInMatch.teamNumber"
[matchNumber]="selectedTeamInMatch.matchNumber"
[setNumber]="selectedTeamInMatch.setNumber"
[compLevel]="selectedTeamInMatch.compLevel"
+ [skipTeamSelection]="navigatedFromMatchList"
*ngSwitchCase="'Entry'"
></app-entry>
<frc971-notes *ngSwitchCase="'Notes'"></frc971-notes>
<app-driver-ranking *ngSwitchCase="'DriverRanking'"></app-driver-ranking>
<shift-schedule *ngSwitchCase="'ShiftSchedule'"></shift-schedule>
- <app-view
- (switchTabsEvent)="switchTabTo($event)"
- *ngSwitchCase="'View'"
- ></app-view>
+ <app-view *ngSwitchCase="'View'"></app-view>
</ng-container>
diff --git a/scouting/www/app/app.ts b/scouting/www/app/app.ts
index f7d2770..c19895a 100644
--- a/scouting/www/app/app.ts
+++ b/scouting/www/app/app.ts
@@ -30,6 +30,9 @@
setNumber: 1,
compLevel: 'qm',
};
+ // Keep track of the match list automatically navigating the user to the
+ // Entry tab.
+ navigatedFromMatchList: boolean = false;
tab: Tab = 'MatchList';
@ViewChild('block_alerts') block_alerts: ElementRef;
@@ -54,7 +57,8 @@
selectTeamInMatch(teamInMatch: TeamInMatch) {
this.selectedTeamInMatch = teamInMatch;
- this.switchTabTo('Entry');
+ this.navigatedFromMatchList = true;
+ this.switchTabTo('Entry', false);
}
switchTabToGuarded(tab: Tab) {
@@ -69,11 +73,16 @@
}
}
if (shouldSwitch) {
- this.switchTabTo(tab);
+ this.switchTabTo(tab, true);
}
}
- private switchTabTo(tab: Tab) {
+ private switchTabTo(tab: Tab, wasGuarded: boolean) {
+ if (wasGuarded) {
+ // When the user navigated between tabs manually, we want to reset some
+ // state.
+ this.navigatedFromMatchList = false;
+ }
this.tab = tab;
}
}
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index 71c8de2..b56948a 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -97,7 +97,7 @@
templateUrl: './entry.ng.html',
styleUrls: ['../app/common.css', './entry.component.css'],
})
-export class EntryComponent {
+export class EntryComponent implements OnInit {
// Re-export the type here so that we can use it in the `[value]` attribute
// of radio buttons.
readonly COMP_LEVELS = COMP_LEVELS;
@@ -106,11 +106,11 @@
readonly ScoreLevel = ScoreLevel;
section: Section = 'Team Selection';
- @Output() switchTabsEvent = new EventEmitter<string>();
@Input() matchNumber: number = 1;
@Input() teamNumber: number = 1;
@Input() setNumber: number = 1;
@Input() compLevel: CompLevel = 'qm';
+ @Input() skipTeamSelection = false;
actionList: ActionT[] = [];
errorMessage: string = '';
@@ -119,6 +119,12 @@
matchStartTimestamp: number = 0;
+ ngOnInit() {
+ // When the user navigated from the match list, we can skip the team
+ // selection. I.e. we trust that the user clicked the correct button.
+ this.section = this.skipTeamSelection ? 'Init' : 'Team Selection';
+ }
+
addAction(action: ActionT): void {
if (action.type == 'startMatchAction') {
// Unix nanosecond timestamp.