Add climbing level to database

I spent a lot of time trying to make this use enums for the entire
data path. Unfortunately, I ran into a few issues. Firstly, I couldn't
figure out how make our Go SQL code happy with postgresql enums. I
kept getting errors about `unknown oid`. Secondly, I couldn't figure
out how to de-duplicate the enum between `submit_data_scouting.fbs`
and `request_data_scouting_response.fbs`. The generated Go code
doesn't import the dependency properly.

All this turned into an enum at the flatbuffer and TypeScript level,
but just an integer at the Go/postgres level.

A future patch can deal with this. Perhaps it'd be better to ignore
this altogether and just switch to a library like Gorm.

Signed-off-by: Philipp Schrader <philipp.schrader@gmail.com>
Change-Id: Id6cbb5502fd77f3107514b8d7cb9df2923a9d5f9
diff --git a/scouting/www/entry/entry.component.ts b/scouting/www/entry/entry.component.ts
index d067c3e..357d6b7 100644
--- a/scouting/www/entry/entry.component.ts
+++ b/scouting/www/entry/entry.component.ts
@@ -2,13 +2,11 @@
 import {FormsModule} from '@angular/forms';
 import {Builder, ByteBuffer} from 'flatbuffers';
 import {ErrorResponse} from 'org_frc971/scouting/webserver/requests/messages/error_response_generated';
-import {SubmitDataScouting} from 'org_frc971/scouting/webserver/requests/messages/submit_data_scouting_generated';
+import {ClimbLevel, SubmitDataScouting} from 'org_frc971/scouting/webserver/requests/messages/submit_data_scouting_generated';
 import {SubmitDataScoutingResponse} from 'org_frc971/scouting/webserver/requests/messages/submit_data_scouting_response_generated';
 
 type Section = 'Team Selection'|'Auto'|'TeleOp'|'Climb'|'Other'|
     'Review and Submit'|'Success';
-type Level = 'NoAttempt'|'Failed'|'FailedWithPlentyOfTime'|'Low'|'Medium'|
-    'High'|'Transversal';
 
 @Component({
   selector: 'app-entry',
@@ -16,6 +14,10 @@
   styleUrls: ['../common.css', './entry.component.css']
 })
 export class EntryComponent {
+  // Re-export the type here so that we can use it in the `[value]` attribute
+  // of radio buttons.
+  readonly ClimbLevel = ClimbLevel;
+
   section: Section = 'Team Selection';
   @Output() switchTabsEvent = new EventEmitter<string>();
   @Input() matchNumber: number = 1;
@@ -28,7 +30,7 @@
   teleShotsMissed: number = 0;
   defensePlayedOnScore: number = 0;
   defensePlayedScore: number = 0;
-  level: Level = 'NoAttempt';
+  level: ClimbLevel = ClimbLevel.NoAttempt;
   ball1: boolean = false;
   ball2: boolean = false;
   ball3: boolean = false;
@@ -56,6 +58,7 @@
     } else if (this.section === 'Other') {
       this.section = 'Review and Submit';
     } else if (this.section === 'Review and Submit') {
+
       this.submitDataScouting();
       return;
     } else if (this.section === 'Success') {
@@ -109,10 +112,8 @@
     SubmitDataScouting.addAutoBall4(builder, this.ball4);
     SubmitDataScouting.addAutoBall5(builder, this.ball5);
     SubmitDataScouting.addStartingQuadrant(builder, this.quadrant);
-
     // TODO(phil): Add support for defensePlayedOnScore.
-    // TODO(phil): Fix the Climbing score.
-    SubmitDataScouting.addClimbing(builder, 1);
+    SubmitDataScouting.addClimbLevel(builder, this.level);
     builder.finish(SubmitDataScouting.endSubmitDataScouting(builder));
 
     const buffer = builder.asUint8Array();