Skip to content

Commit 0fcf37c

Browse files
authored
Merge pull request #23 from ppolariss/main
chore: debug question
2 parents 608a351 + 98db180 commit 0fcf37c

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

apis/question.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
9696

9797
copy(tmpQuestions, requiredQuestions)
9898

99+
jsonTmpQuestions, _ := json.Marshal(questionConfig)
100+
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))
101+
102+
jsonTmpQuestions, _ = json.Marshal(tmpQuestions)
103+
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))
104+
99105
// for i, question := range requiredQuestions {
100106
// tmpQuestions[i] = question
101107
// // questionsResponse.Questions[i] = *question
@@ -130,6 +136,9 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
130136
tmpQuestions = append(tmpQuestions, chosenCampusQuestions[:numberOfCampusQuestions]...)
131137
}
132138

139+
jsonTmpQuestions, _ = json.Marshal(tmpQuestions)
140+
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))
141+
133142
if !inOrder {
134143
rand.Shuffle(len(tmpQuestions), func(i, j int) {
135144
tmpQuestions[i], tmpQuestions[j] = tmpQuestions[j], tmpQuestions[i]
@@ -140,6 +149,9 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
140149
})
141150
}
142151

152+
jsonTmpQuestions, _ = json.Marshal(tmpQuestions)
153+
log.Debug().Msgf("questionsResponse: %s", string(jsonTmpQuestions))
154+
143155
for i, question := range tmpQuestions {
144156
questionsResponse.Questions[i] = *question
145157
}
@@ -165,9 +177,6 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
165177
questionsResponse.Questions[i].Option = questionsResponse.Questions[i].Options
166178
}
167179

168-
jsonQuestions, _ = json.Marshal(questionsResponse)
169-
log.Debug().Msgf("questionsResponse: %s", string(jsonQuestions))
170-
171180
return c.JSON(questionsResponse)
172181
}
173182

0 commit comments

Comments
 (0)