Spaces:
Configuration error
Configuration error
Download space/controller/quiz/answer_quiz_controller.go from lifedebugger/api-qobiltu-dev: direct link, hf CLI and curl.
- Browser
- Download file 825 Bytes
-
https://huggingface.co/spaces/lifedebugger/api-qobiltu-dev/resolve/main/space/controller/quiz/answer_quiz_controller.go
- Command line
-
hf download hf://spaces/lifedebugger/api-qobiltu-dev/space/controller/quiz/answer_quiz_controller.go
-
curl -L -o answer_quiz_controller.go https://huggingface.co/spaces/lifedebugger/api-qobiltu-dev/resolve/main/space/controller/quiz/answer_quiz_controller.go
825 Bytes
| package controller | |
| import ( | |
| "strconv" | |
| "api.qobiltu.id/controller" | |
| "api.qobiltu.id/models" | |
| "api.qobiltu.id/services" | |
| "github.com/gin-gonic/gin" | |
| ) | |
| func Answer(c *gin.Context) { | |
| quizAnswer := services.AnswerQuizService{} | |
| quizAnswerController := controller.Controller[models.AnswerQuizRequest, models.Quiz, models.QuestionResponse]{ | |
| Service: &quizAnswer.Service, | |
| } | |
| quizAnswerController.RequestJSON(c, func() { | |
| quizId, _ := strconv.Atoi(c.Param("quiz_id")) | |
| academyId, _ := strconv.Atoi(c.Param("academy_id")) | |
| quizAnswerController.Service.Constructor.ID = uint(quizId) | |
| quizAnswerController.Service.Constructor.AcademyID = uint(academyId) | |
| quizAnswer.Update(quizAnswerController.AccountData.UserID, quizAnswerController.Request.QuestionNo, quizAnswerController.Request.Answer) | |
| }) | |
| } | |