You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val season = jsonWorker.decodeFromJsonElement<Season>(seasonData)
349
349
val gradeLevelIndex =if (season.program.id ==1) 0elseif (season.program.id ==4) 1else-1
350
350
if (gradeLevelIndex !=-1) {
351
-
this.seasonIdMap[gradeLevelIndex].add(season)
351
+
this.seasonsCache[gradeLevelIndex].add(season)
352
352
}
353
353
}
354
354
355
355
println("Season ID map generated")
356
-
/*for (gradeLevel in this.seasonIdMap) {
356
+
/*for (gradeLevel in this.seasonsCache) {
357
357
for (season in gradeLevel) {
358
358
println("ID: ${season.id}, Name: ${season.name}")
359
359
}
@@ -369,18 +369,18 @@ class RoboScoutAPI {
369
369
}
370
370
371
371
funactiveSeasonId(): Int {
372
-
returnif (this.seasonIdMap.isNotEmpty()) {
372
+
returnif (this.seasonsCache.isNotEmpty()) {
373
373
if (this.gradeLevel !="College") {
374
374
try {
375
-
this.seasonIdMap[0].first().id
375
+
this.seasonsCache[0].first().id
376
376
}
377
377
catch (e:NoSuchElementException) {
378
378
BuildConfig.DEFAULT_V5_SEASON_ID
379
379
}
380
380
}
381
381
else {
382
382
try {
383
-
this.seasonIdMap[1].first().id
383
+
this.seasonsCache[1].first().id
384
384
}
385
385
catch (e:NoSuchElementException) {
386
386
BuildConfig.DEFAULT_VU_SEASON_ID
@@ -477,8 +477,8 @@ class RoboScoutAPI {
477
477
var totalAP =0
478
478
var totalWP =0
479
479
480
-
val seasonIndex =API.seasonIdMap[if (API.selectedProgramId() ==4) 1else0].indexOfFirst { it.id ==API.selectedSeasonId() }
481
-
val season =API.seasonIdMap[if (team.grade =="College") 1else0][seasonIndex]
480
+
val seasonIndex =API.seasonsCache[if (API.selectedProgramId() ==4) 1else0].indexOfFirst { it.id ==API.selectedSeasonId() }
481
+
val season =API.seasonsCache[if (team.grade =="College") 1else0][seasonIndex]
482
482
483
483
val reRankingsData = roboteventsRequest("/teams/${team.id}/rankings", mapOf("season" to season.id))
484
484
val reRankings = reRankingsData.map { jsonWorker.decodeFromJsonElement<TeamRanking>(it) }
@@ -1122,8 +1122,8 @@ class Team : MutableState<Team> {
1122
1122
suspendfunfetchEvents(season:Int? = null) {
1123
1123
val data:List<JsonObject>
1124
1124
if (season ==null) {
1125
-
val seasonIndex =API.seasonIdMap[if (API.selectedProgramId() ==4) 1else0].indexOfFirst { it.id ==API.selectedSeasonId() }
1126
-
data =RoboScoutAPI.roboteventsRequest("/events", mapOf("team" to id, "season" to (API.seasonIdMap[if (this.grade =="College") 1else0][seasonIndex].id)))
1125
+
val seasonIndex =API.seasonsCache[if (API.selectedProgramId() ==4) 1else0].indexOfFirst { it.id ==API.selectedSeasonId() }
1126
+
data =RoboScoutAPI.roboteventsRequest("/events", mapOf("team" to id, "season" to (API.seasonsCache[if (this.grade =="College") 1else0][seasonIndex].id)))
1127
1127
}
1128
1128
else {
1129
1129
data =RoboScoutAPI.roboteventsRequest("/events", mapOf("team" to id, "season" to season))
0 commit comments