Skip to content

Commit

Permalink
Always set alliance color
Browse files Browse the repository at this point in the history
Also rename populateMatchDataIfCompetition() and update docs
  • Loading branch information
KangarooKoala committed Mar 18, 2024
1 parent 952d527 commit ca62547
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun StartMatchView(
LaunchedEffect(true) {
viewModel.apply {
this.scoutingScheduleManager = scoutingScheduleManager
populateMatchDataIfCompetition()
populateMatchData()
}
managedMatch = MMKV.defaultMMKV().decodeBool("COMPETITION_MODE", false)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,15 @@ class ScoutingViewModel : ViewModel() {
}

/**
* Reset text fields when in the StartMatchView, either as blank or if a
* competition schedule has been loaded, with the according team number,
* match number and alliance according to the set device position
* Update the fields in StartMatchView. If a competition schedule is
* enabled, match number and team number are set according to the set
* device position, otherwise they are set to blank. Alliance color is
* always set.
*/
fun populateMatchDataIfCompetition() {
fun populateMatchData() {
currentAllianceMonitoring =
AllianceType.valueOf(preferences.decodeString("DEVICE_ALLIANCE_POSITION", "RED")!!)
if (preferences.decodeBool("COMPETITION_MODE", false)) {
currentAllianceMonitoring =
AllianceType.valueOf(preferences.decodeString("DEVICE_ALLIANCE_POSITION", "RED")!!)
currentMatchMonitoring =
TextFieldValue((scoutingScheduleManager.currentMatchScoutingIteration + 1).toString())
currentTeamNumberMonitoring = TextFieldValue(scoutingScheduleManager.getCurrentTeam())
Expand Down

0 comments on commit ca62547

Please sign in to comment.