Skip to content

Commit

Permalink
Merge pull request #23 from ppolariss/main
Browse files Browse the repository at this point in the history
chore: debug question
  • Loading branch information
JingYiJun authored Jul 29, 2024
2 parents 608a351 + 98db180 commit 0fcf37c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions apis/question.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {

copy(tmpQuestions, requiredQuestions)

jsonTmpQuestions, _ := json.Marshal(questionConfig)
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))

jsonTmpQuestions, _ = json.Marshal(tmpQuestions)
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))

// for i, question := range requiredQuestions {
// tmpQuestions[i] = question
// // questionsResponse.Questions[i] = *question
Expand Down Expand Up @@ -130,6 +136,9 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
tmpQuestions = append(tmpQuestions, chosenCampusQuestions[:numberOfCampusQuestions]...)
}

jsonTmpQuestions, _ = json.Marshal(tmpQuestions)
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))

if !inOrder {
rand.Shuffle(len(tmpQuestions), func(i, j int) {
tmpQuestions[i], tmpQuestions[j] = tmpQuestions[j], tmpQuestions[i]
Expand All @@ -140,6 +149,9 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
})
}

jsonTmpQuestions, _ = json.Marshal(tmpQuestions)
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))

for i, question := range tmpQuestions {
questionsResponse.Questions[i] = *question
}
Expand All @@ -165,9 +177,6 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
questionsResponse.Questions[i].Option = questionsResponse.Questions[i].Options
}

jsonQuestions, _ = json.Marshal(questionsResponse)
log.Debug().Msgf("questionsResponse: %s", string(jsonQuestions))

return c.JSON(questionsResponse)
}

Expand Down

0 comments on commit 0fcf37c

Please sign in to comment.