Allow scouts to pre-scout matches using the app

Users can now select the new "pre-scouting" checkbox. That will bypass
the match list validation.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: I35fed86b8107fc11a1335f73e679b1272d4da81b
diff --git a/scouting/scouting_test.cy.js b/scouting/scouting_test.cy.js
index 3087454..a69465f 100644
--- a/scouting/scouting_test.cy.js
+++ b/scouting/scouting_test.cy.js
@@ -108,6 +108,21 @@
     cy.contains('button', 'Next').should('be.disabled');
   });
 
+  it('should: allow users to scout non-existent matches when pre-scouting.', () => {
+    switchToTab('Entry');
+    headerShouldBe(' Team Selection ');
+    setInputTo('#team_number', '1');
+
+    // The default team information should be invalid.
+    cy.contains('button', 'Next').should('be.disabled');
+
+    // Click the checkmark to designate this as pre-scouting.
+    // We should now be able to continue scouting.
+    cy.get('#pre_scouting').click();
+    clickButton('Next');
+    headerShouldBe('1 Init ');
+  });
+
   it('should: let users enter match information manually.', () => {
     switchToTab('Entry');
     headerShouldBe(' Team Selection ');
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index 56ee122..290e2fb 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -129,6 +129,7 @@
   autoPhase: boolean = true;
   lastObject: ObjectType = null;
 
+  preScouting: boolean = false;
   matchStartTimestamp: number = 0;
 
   teamSelectionIsValid = false;
@@ -160,9 +161,9 @@
 
   // This gets called when the user changes something on the Init screen.
   // It makes sure that the user can't click "Next" until the information is
-  // valid.
+  // valid, or this is for pre-scouting.
   updateTeamSelectionValidity(): void {
-    this.teamSelectionIsValid = this.matchIsInMatchList();
+    this.teamSelectionIsValid = this.preScouting || this.matchIsInMatchList();
   }
 
   matchIsInMatchList(): boolean {
@@ -384,6 +385,7 @@
     SubmitActions.addSetNumber(builder, this.setNumber);
     SubmitActions.addCompLevel(builder, compLevelFb);
     SubmitActions.addActionsList(builder, actionsVector);
+    SubmitActions.addPreScouting(builder, this.preScouting);
     builder.finish(SubmitActions.endSubmitActions(builder));
 
     const buffer = builder.asUint8Array();
diff --git a/scouting/www/entry/entry.ng.html b/scouting/www/entry/entry.ng.html
index 13cbe7f..e189ab0 100644
--- a/scouting/www/entry/entry.ng.html
+++ b/scouting/www/entry/entry.ng.html
@@ -56,6 +56,17 @@
         </option>
       </select>
     </div>
+    <div class="row">
+      <label>
+        <input
+          id="pre_scouting"
+          type="checkbox"
+          [(ngModel)]="preScouting"
+          (ngModelChange)="updateTeamSelectionValidity()"
+        />
+        Pre-scouting
+      </label>
+    </div>
     <div class="buttons">
       <!-- hack to right align the next button -->
       <div></div>