11package apis
22
33import (
4+ "encoding/json"
45 "fmt"
56 "sort"
67
8+ . "auth_next/models"
9+
710 "github.com/gofiber/fiber/v2"
811 "github.com/opentreehole/go-common"
12+ "github.com/rs/zerolog/log"
913 "golang.org/x/exp/rand"
1014 "golang.org/x/exp/slices"
11-
12- . "auth_next/models"
1315)
1416
1517// RetrieveQuestions godoc
@@ -128,8 +130,6 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
128130 tmpQuestions = append (tmpQuestions , chosenCampusQuestions [:numberOfCampusQuestions ]... )
129131 }
130132
131-
132-
133133 if ! inOrder {
134134 rand .Shuffle (len (tmpQuestions ), func (i , j int ) {
135135 tmpQuestions [i ], tmpQuestions [j ] = tmpQuestions [j ], tmpQuestions [i ]
@@ -144,6 +144,9 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
144144 questionsResponse .Questions [i ] = * question
145145 }
146146
147+ jsonQuestions , _ := json .Marshal (questionsResponse )
148+ log .Debug ().Msgf ("questionsResponse: %s" , string (jsonQuestions ))
149+
147150 // shuffle options
148151 for i := range questionsResponse .Questions {
149152 options := questionsResponse .Questions [i ].Options // copy slice pointer only
@@ -162,6 +165,9 @@ func RetrieveQuestions(c *fiber.Ctx) (err error) {
162165 questionsResponse .Questions [i ].Option = questionsResponse .Questions [i ].Options
163166 }
164167
168+ jsonQuestions , _ = json .Marshal (questionsResponse )
169+ log .Debug ().Msgf ("questionsResponse: %s" , string (jsonQuestions ))
170+
165171 return c .JSON (questionsResponse )
166172}
167173
0 commit comments