Skip to content

Commit

Permalink
addressing review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshil Gupta authored and wololowarrior committed Oct 21, 2024
1 parent 3b5999d commit 0099902
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions cmd/challenge/catalog.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ func newCatalogCommand(cli labcli.CLI) *cobra.Command {
&opts.category,
"category",
[]string{},
`Category to filter by - one or multiple categories like linux, containers, kubernetes, ... (an empty string means all)`,
`Category to filter by - one or multiple categories like linux, containers, kubernetes`,
)

flags.StringSliceVar(
&opts.status,
"status",
[]string{},
`status to filter by - one or multiple status like todo, attempted, solved ... (empty means all))`,
`status to filter by - one or multiple status like todo, attempted, solved)`,
)

return cmd
Expand Down
14 changes: 6 additions & 8 deletions internal/api/challenges.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,13 @@ type ListChallengesOptions struct {
func (c *Client) ListChallenges(ctx context.Context, opts *ListChallengesOptions) ([]*Challenge, error) {
var challenges []*Challenge
query := url.Values{}
if opts.Category != nil {
for _, category := range opts.Category {
query.Add("category",category)
}

for _, category := range opts.Category {
query.Add("category", category)
}
if opts.Status != nil {
for _, status := range opts.Status {
query.Add("status",status)
}

for _, status := range opts.Status {
query.Add("status", status)
}

return challenges, c.GetInto(ctx, "/challenges", query, nil, &challenges)
Expand Down

0 comments on commit 0099902

Please sign in to comment.