Skip to content

Commit

Permalink
no track
Browse files Browse the repository at this point in the history
Signed-off-by: Raphaël Pinson <[email protected]>
  • Loading branch information
raphink committed Nov 1, 2024
1 parent f331e91 commit f95ef70
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 11 deletions.
9 changes: 9 additions & 0 deletions instruqt/challenge.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ type Challenge struct {
} `json:"-"`
}

// ChallengeNoTrack represents the data structure for an Instruqt challenge.
type ChallengeNoTrack struct {
Id string `json:"id"` // The unique identifier for the challenge.
Slug string `json:"slug"` // The slug for the challenge, which is a human-readable identifier.
Title string `json:"title"` // The title of the challenge.
Index int `json:"index"` // The index of the challenge in the track.
Status string `json:"status"` // The status of the challenge (e.g., "unlocked", "completed").
}

// GetChallenge retrieves a challenge from Instruqt using its unique challenge ID.
//
// Parameters:
Expand Down
22 changes: 11 additions & 11 deletions instruqt/track.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ type SandboxTrack struct {
TotalCount int
Nodes []Review
}
Challenges []Challenge // A list of challenges associated with the sandbox track.
Status string // The current status of the sandbox track.
Started time.Time // The timestamp when the sandbox track was started.
Completed time.Time // The timestamp when the sandbox track was completed.
Participant struct { // Information about the participant of the sandbox track.
Challenges []ChallengeNoTrack // A list of challenges associated with the sandbox track.
Status string // The current status of the sandbox track.
Started time.Time // The timestamp when the sandbox track was started.
Completed time.Time // The timestamp when the sandbox track was completed.
Participant struct { // Information about the participant of the sandbox track.
Id string
}
}
Expand All @@ -117,11 +117,11 @@ type SandboxTrackNoReviews struct {
TrackTags []struct { // A list of tags associated with the sandbox track.
Value string
}
Challenges []Challenge // A list of challenges associated with the sandbox track.
Status string // The current status of the sandbox track.
Started time.Time // The timestamp when the sandbox track was started.
Completed time.Time // The timestamp when the sandbox track was completed.
Participant struct { // Information about the participant of the sandbox track.
Challenges []ChallengeNoTrack // A list of challenges associated with the sandbox track.
Status string // The current status of the sandbox track.
Started time.Time // The timestamp when the sandbox track was started.
Completed time.Time // The timestamp when the sandbox track was completed.
Participant struct { // Information about the participant of the sandbox track.
Id string
}
}
Expand Down Expand Up @@ -216,7 +216,7 @@ func (c *Client) GetTrackBySlug(trackSlug string) (t Track, err error) {
// Returns:
// - Challenge: The first unlocked challenge found.
// - error: Any error encountered while retrieving the challenge.
func (c *Client) GetTrackUnlockedChallenge(userId string, trackId string) (challenge Challenge, err error) {
func (c *Client) GetTrackUnlockedChallenge(userId string, trackId string) (challenge ChallengeNoTrack, err error) {
track, err := c.GetUserTrackById(userId, trackId)
if err != nil {
return challenge, fmt.Errorf("[instruqt.GetTrackUnlockedChallenge] failed to get user track: %v", err)
Expand Down

0 comments on commit f95ef70

Please sign in to comment.