add qid to excel file answer path
This commit is contained in:
parent
cf974729bd
commit
6f55c35b7b
@ -22,6 +22,7 @@ services:
|
|||||||
TRASH_LOG_HOST: "10.8.0.15:7113"
|
TRASH_LOG_HOST: "10.8.0.15:7113"
|
||||||
MODULE_LOGGER: "quiz-core-main"
|
MODULE_LOGGER: "quiz-core-main"
|
||||||
CLICK_HOUSE_CRED: "clickhouse://10.8.0.15:9000/default?sslmode=disable"
|
CLICK_HOUSE_CRED: "clickhouse://10.8.0.15:9000/default?sslmode=disable"
|
||||||
|
S3_PREFIX: "https://s3.timeweb.cloud/3c580be9-cf31f296-d055-49cf-b39e-30c7959dc17b/squizimages/"
|
||||||
ports:
|
ports:
|
||||||
- 10.8.0.9:1488:1488
|
- 10.8.0.9:1488:1488
|
||||||
- 10.8.0.9:9000:9000
|
- 10.8.0.9:9000:9000
|
||||||
|
@ -159,6 +159,11 @@ func (s *Service) ExportResultsToCSV(ctx *fiber.Ctx) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
quiz, err := s.dal.QuizRepo.GetQuizById(ctx.Context(), accountID, quizID)
|
||||||
|
if err != nil {
|
||||||
|
return ctx.Status(fiber.StatusInternalServerError).SendString("failed to get quiz")
|
||||||
|
}
|
||||||
|
|
||||||
questions, err := s.dal.ResultRepo.GetQuestions(ctx.Context(), quizID)
|
questions, err := s.dal.ResultRepo.GetQuestions(ctx.Context(), quizID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("failed to get questions")
|
return ctx.Status(fiber.StatusInternalServerError).SendString("failed to get questions")
|
||||||
@ -177,7 +182,7 @@ func (s *Service) ExportResultsToCSV(ctx *fiber.Ctx) error {
|
|||||||
|
|
||||||
buffer := new(bytes.Buffer)
|
buffer := new(bytes.Buffer)
|
||||||
|
|
||||||
if err := tools.WriteDataToExcel(buffer, questions, answers, s.s3Prefix); err != nil {
|
if err := tools.WriteDataToExcel(buffer, questions, answers, s.s3Prefix + quiz.Qid + "/"); err != nil {
|
||||||
return ctx.Status(fiber.StatusInternalServerError).SendString("failed to write data to Excel")
|
return ctx.Status(fiber.StatusInternalServerError).SendString("failed to write data to Excel")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user