Skip to content

Commit 72a3204

Browse files
authored
Merge pull request #4 from LemLib/feat/prioritize-vrc-search
feat: Sort team search by program ID
2 parents 5208914 + 6d018ed commit 72a3204

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/commands/team.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,11 @@ impl TeamCommand {
594594
query = query.program(program_id_filter);
595595
}
596596

597-
if let Ok(teams) = robotevents.teams(query).await {
597+
if let Ok(mut teams) = robotevents.teams(query).await {
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));
601+
598602
if let Some(team) = teams.data.iter().next() {
599603
self.team = Some(team.clone()); // Cache value for later use.
600604
return Ok(team.clone());

0 commit comments

Comments
 (0)