challenge-sync-airbus: Ready for 2024

This commit is contained in:
nemunaire 2024-03-19 11:49:39 +01:00
commit ac966f9023
5 changed files with 273 additions and 115 deletions

View file

@ -8,6 +8,8 @@ type AirbusTeam struct {
ID int64 `json:"id"`
Members []TeamMember `json:"members"`
Name string `json:"name"`
Score int64 `json:"score"`
Rank int `json:"rank"`
}
type TeamMember struct {
@ -30,3 +32,15 @@ func (a *AirbusAPI) GetTeams() ([]AirbusTeam, error) {
return data.Data, nil
}
}
type ByRank []*AirbusTeam
func (a ByRank) Len() int { return len(a) }
func (a ByRank) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByRank) Less(i, j int) bool { return a[i].Rank < a[j].Rank }
type ByScore []*AirbusTeam
func (a ByScore) Len() int { return len(a) }
func (a ByScore) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
func (a ByScore) Less(i, j int) bool { return a[i].Score < a[j].Score }