Delete Stats object and replace with Stats2023

Deleting the stats object in the database and any functions/files that are using it and replacing it with Stats2023 in the view tab.

Signed-off-by: Emily Markova <emily.markova@gmail.com>
Change-Id: I76f5ad9e3f5d4a6ede60266fdc179e21013d6093
diff --git a/scouting/www/rpc/BUILD b/scouting/www/rpc/BUILD
index 427b493..113c747 100644
--- a/scouting/www/rpc/BUILD
+++ b/scouting/www/rpc/BUILD
@@ -11,14 +11,14 @@
     generate_public_api = False,
     deps = [
         "//scouting/webserver/requests/messages:error_response_ts_fbs",
+        "//scouting/webserver/requests/messages:request_2023_data_scouting_response_ts_fbs",
+        "//scouting/webserver/requests/messages:request_2023_data_scouting_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_driver_rankings_response_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_driver_rankings_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_matches_response_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_matches_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_notes_response_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_notes_ts_fbs",
-        "//scouting/webserver/requests/messages:request_data_scouting_response_ts_fbs",
-        "//scouting/webserver/requests/messages:request_data_scouting_ts_fbs",
         "@com_github_google_flatbuffers//ts:flatbuffers_ts",
     ],
 )
diff --git a/scouting/www/rpc/view_data_requestor.ts b/scouting/www/rpc/view_data_requestor.ts
index d41bf43..24d10b6 100644
--- a/scouting/www/rpc/view_data_requestor.ts
+++ b/scouting/www/rpc/view_data_requestor.ts
@@ -11,11 +11,11 @@
   Ranking,
   RequestAllDriverRankingsResponse,
 } from '../../webserver/requests/messages/request_all_driver_rankings_response_generated';
-import {RequestDataScouting} from '../../webserver/requests/messages/request_data_scouting_generated';
+import {Request2023DataScouting} from '../../webserver/requests/messages/request_2023_data_scouting_generated';
 import {
-  Stats,
-  RequestDataScoutingResponse,
-} from '../../webserver/requests/messages/request_data_scouting_response_generated';
+  Stats2023,
+  Request2023DataScoutingResponse,
+} from '../../webserver/requests/messages/request_2023_data_scouting_response_generated';
 
 @Injectable({providedIn: 'root'})
 export class ViewDataRequestor {
@@ -77,15 +77,15 @@
     return driverRankingList;
   }
   // Returns all data scouting entries from the database.
-  async fetchStatsList(): Promise<Stats[]> {
+  async fetchStats2023List(): Promise<Stats2023[]> {
     let fbBuffer = await this.fetchFromServer(
-      RequestDataScouting.startRequestDataScouting,
-      RequestDataScouting.endRequestDataScouting,
-      '/requests/request/data_scouting'
+      Request2023DataScouting.startRequest2023DataScouting,
+      Request2023DataScouting.endRequest2023DataScouting,
+      '/requests/request/2023_data_scouting'
     );
 
     const parsedResponse =
-      RequestDataScoutingResponse.getRootAsRequestDataScoutingResponse(
+      Request2023DataScoutingResponse.getRootAsRequest2023DataScoutingResponse(
         fbBuffer
       );
 
diff --git a/scouting/www/view/BUILD b/scouting/www/view/BUILD
index 25aa9fa..d787e8f 100644
--- a/scouting/www/view/BUILD
+++ b/scouting/www/view/BUILD
@@ -11,12 +11,12 @@
     deps = [
         ":node_modules/@angular/forms",
         "//scouting/webserver/requests/messages:error_response_ts_fbs",
+        "//scouting/webserver/requests/messages:request_2023_data_scouting_response_ts_fbs",
+        "//scouting/webserver/requests/messages:request_2023_data_scouting_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_driver_rankings_response_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_driver_rankings_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_notes_response_ts_fbs",
         "//scouting/webserver/requests/messages:request_all_notes_ts_fbs",
-        "//scouting/webserver/requests/messages:request_data_scouting_response_ts_fbs",
-        "//scouting/webserver/requests/messages:request_data_scouting_ts_fbs",
         "//scouting/www/rpc",
         "@com_github_google_flatbuffers//ts:flatbuffers_ts",
     ],
diff --git a/scouting/www/view/view.component.ts b/scouting/www/view/view.component.ts
index f4a55a1..f5b4d6a 100644
--- a/scouting/www/view/view.component.ts
+++ b/scouting/www/view/view.component.ts
@@ -4,9 +4,9 @@
   RequestAllDriverRankingsResponse,
 } from '../../webserver/requests/messages/request_all_driver_rankings_response_generated';
 import {
-  Stats,
-  RequestDataScoutingResponse,
-} from '../../webserver/requests/messages/request_data_scouting_response_generated';
+  Stats2023,
+  Request2023DataScoutingResponse,
+} from '../../webserver/requests/messages/request_2023_data_scouting_response_generated';
 import {
   Note,
   RequestAllNotesResponse,
@@ -14,7 +14,7 @@
 
 import {ViewDataRequestor} from '../rpc';
 
-type Source = 'Notes' | 'Stats' | 'DriverRanking';
+type Source = 'Notes' | 'Stats2023' | 'DriverRanking';
 
 //TODO(Filip): Deduplicate
 const COMP_LEVEL_LABELS = {
@@ -52,7 +52,7 @@
   // Stores the corresponding data.
   noteList: Note[] = [];
   driverRankingList: Ranking[] = [];
-  statList: Stats[] = [];
+  statList: Stats2023[] = [];
 
   // Fetch notes on initialization.
   ngOnInit() {
@@ -66,11 +66,11 @@
     if (!this.ascendingSort) {
       this.driverRankingList.sort((a, b) => b.matchNumber() - a.matchNumber());
       this.noteList.sort((a, b) => b.team() - a.team());
-      this.statList.sort((a, b) => b.match() - a.match());
+      this.statList.sort((a, b) => b.matchNumber() - a.matchNumber());
     } else {
       this.driverRankingList.sort((a, b) => a.matchNumber() - b.matchNumber());
       this.noteList.sort((a, b) => a.team() - b.team());
-      this.statList.sort((a, b) => a.match() - b.match());
+      this.statList.sort((a, b) => a.matchNumber() - b.matchNumber());
     }
   }
 
@@ -93,8 +93,8 @@
         this.fetchNotes();
       }
 
-      case 'Stats': {
-        this.fetchStats();
+      case 'Stats2023': {
+        this.fetchStats2023();
       }
 
       case 'DriverRanking': {
@@ -133,12 +133,12 @@
   }
 
   // Fetch all data scouting (stats) data and store in statList.
-  async fetchStats() {
+  async fetchStats2023() {
     this.progressMessage = 'Fetching stats list. Please be patient.';
     this.errorMessage = '';
 
     try {
-      this.statList = await this.viewDataRequestor.fetchStatsList();
+      this.statList = await this.viewDataRequestor.fetchStats2023List();
       this.progressMessage = 'Successfully fetched stats list.';
     } catch (e) {
       this.errorMessage = e;
diff --git a/scouting/www/view/view.ng.html b/scouting/www/view/view.ng.html
index c361638..667765f 100644
--- a/scouting/www/view/view.ng.html
+++ b/scouting/www/view/view.ng.html
@@ -16,7 +16,7 @@
       </a>
     </li>
     <li>
-      <a class="dropdown-item" href="#" (click)="switchDataSource('Stats')">
+      <a class="dropdown-item" href="#" (click)="switchDataSource('Stats2023')">
         Stats
       </a>
     </li>
@@ -73,7 +73,7 @@
     </table>
   </div>
   <!-- Stats Data Display. -->
-  <div *ngSwitchCase="'Stats'">
+  <div *ngSwitchCase="'Stats2023'">
     <table class="table">
       <thead>
         <tr>
@@ -93,11 +93,11 @@
         </tr>
       </thead>
       <tbody>
-        <tr *ngFor="let stat of statList; index as i;">
-          <th scope="row">{{stat.match()}}</th>
-          <td>{{stat.team()}}</td>
-          <td>{{stat.setNumber()}}</td>
-          <td>{{COMP_LEVEL_LABELS[stat.compLevel()]}}</td>
+        <tr *ngFor="let stat2023 of statList; index as i;">
+          <th scope="row">{{stat2023.match()}}</th>
+          <td>{{stat2023.team()}}</td>
+          <td>{{stat2023.setNumber()}}</td>
+          <td>{{COMP_LEVEL_LABELS[stat2023.compLevel()]}}</td>
           <!-- Delete Icon. -->
           <td>
             <button class="btn btn-danger" (click)="deleteData()">