Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug session #13

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
6 changes: 4 additions & 2 deletions instruqt/play.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ type PlayReports struct {

// PlayReport represents the data structure for a single play report on Instruqt.
type PlayReport struct {
Id string // The unique identifier for the play report.
Track SandboxTrack // The track played.
Id string // The unique identifier for the play report.
Track SandboxTrackNoReviews // The track played.

TrackInvite TrackInvite // The optional Track invite associated to the play.

Expand Down Expand Up @@ -143,6 +143,8 @@ func (c *Client) GetPlays(from time.Time, to time.Time, take int, skip int, opts
userIds[i] = graphql.String(id)
}

c.InfoLogger.Printf("teamslug: %s", c.TeamSlug)

// Prepare the variables map for the GraphQL query
variables := map[string]interface{}{
"teamSlug": graphql.String(c.TeamSlug),
Expand Down
38 changes: 32 additions & 6 deletions instruqt/track.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,37 @@ 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
}
}

// SandboxTrackNoReviews represents a track in a sandbox environment, including its details
// and associated challenges, without reviews.
type SandboxTrackNoReviews struct {
Id string // The unique identifier for the sandbox track.
Slug string // The slug identifier for the sandbox track.
Icon string // The icon associated with the sandbox track.
Title string // The title of the sandbox track.
Description string // The description of the sandbox track.
Teaser string // A teaser or short description of the sandbox track.
Level string // The difficulty level of the sandbox track.
Embed_Token string // The token used for embedding the sandbox track.
Statistics struct { // Statistics about the sandbox track.
Average_review_score float32 // The average review score of the sandbox track.
}
TrackTags []struct { // A list of tags associated with the sandbox track.
Value string
}
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 @@ -190,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
Loading