Skip to content

Commit 6d018ed

Browse files
committed
prioritize active teams
1 parent e36c1ef commit 6d018ed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/commands/team.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -595,9 +595,9 @@ impl TeamCommand {
595595
}
596596

597597
if let Ok(mut teams) = robotevents.teams(query).await {
598-
// Sort by lowest program ID to prioritize VRC teams in the search
599-
// NOTE: VRC Internally has an ID of 1, making it the lowest numeric program ID
600-
teams.data.sort_by(|a, b| a.program.id.cmp(&b.program.id));
598+
// Prioritize teams that are registered over teams that are not registered.
599+
// From there, pick the team with the lowest numeric program ID (VRC has the lowest ID being `1`).
600+
teams.data.sort_by_key(|team| (!team.registered, team.program.id));
601601

602602
if let Some(team) = teams.data.iter().next() {
603603
self.team = Some(team.clone()); // Cache value for later use.

0 commit comments

Comments
 (0)