Skip to content

Commit

Permalink
fix: structs not showing anything
Browse files Browse the repository at this point in the history
  • Loading branch information
Hopertz committed Sep 1, 2024
1 parent d05ba75 commit 37d6ece
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cmd/api/leaderboard.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ type Member struct {
}

type Data struct {
username string
rating int
Username string
Rating int
}

const user_url = "https://lichess.org/api/users"
Expand Down Expand Up @@ -74,18 +74,18 @@ func (app *application) leaderboardHandler(c echo.Context) error {

for _, user := range members {
if !user.Disabled {
rapid = append(rapid, Data{username: user.Username, rating: user.Perfs["rapid"].Rating})
blitz = append(blitz, Data{username: user.Username, rating: user.Perfs["blitz"].Rating})
rapid = append(rapid, Data{Username: user.Username, Rating: user.Perfs["rapid"].Rating})
blitz = append(blitz, Data{Username: user.Username, Rating: user.Perfs["blitz"].Rating})
}

}

sort.Slice(rapid, func(i, j int) bool {
return rapid[i].rating > rapid[j].rating
return rapid[i].Rating > rapid[j].Rating
})

sort.Slice(blitz, func(i, j int) bool {
return blitz[i].rating > blitz[j].rating
return blitz[i].Rating > blitz[j].Rating
})

summary := make(map[string][]Data)
Expand Down

0 comments on commit 37d6ece

Please sign in to comment.