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/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()">