diff --git a/apis/question.go b/apis/question.go index 1b23e92..9984005 100644 --- a/apis/question.go +++ b/apis/question.go @@ -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 @@ -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] @@ -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 } @@ -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) }