From 0c6e9a4b4c8e707021334bebbb960c917bbdbb24 Mon Sep 17 00:00:00 2001 From: Pasha Date: Wed, 14 May 2025 15:53:37 +0300 Subject: [PATCH] added field auditory in req settings --- go.mod | 5 +---- go.sum | 15 ++------------- service/service.go | 5 +++-- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/go.mod b/go.mod index 47a118d..6fd71ae 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,7 @@ require ( gitea.pena/PenaSide/common v0.0.0-20250103085335-91ea31fee517 gitea.pena/PenaSide/hlog v0.0.0-20241125221102-a54c29c002a9 gitea.pena/PenaSide/trashlog v0.0.0-20250224122049-ddb4d72e9d07 - gitea.pena/SQuiz/common v0.0.0-20250425155255-ad4095b7c130 + gitea.pena/SQuiz/common v0.0.0-20250514124515-870e52266ca5 github.com/go-redis/redis/v8 v8.11.5 github.com/gofiber/fiber/v2 v2.52.5 github.com/minio/minio-go/v7 v7.0.81 @@ -21,7 +21,6 @@ require ( gitea.pena/PenaSide/linters-golang v0.0.0-20241207122018-933207374735 // indirect github.com/ClickHouse/clickhouse-go v1.5.4 // indirect github.com/andybalholm/brotli v1.1.0 // indirect - github.com/caarlos0/env/v8 v8.0.0 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cloudflare/golz4 v0.0.0-20150217214814-ef862a3cdc58 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect @@ -38,7 +37,6 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/minio/md5-simd v1.1.2 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/tealeg/xlsx v1.0.5 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect @@ -53,5 +51,4 @@ require ( google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect google.golang.org/grpc v1.64.0 // indirect google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/tucnak/telebot.v2 v2.5.0 // indirect ) diff --git a/go.sum b/go.sum index 9e56cdf..a2f39ce 100644 --- a/go.sum +++ b/go.sum @@ -2,22 +2,12 @@ gitea.pena/PenaSide/common v0.0.0-20250103085335-91ea31fee517 h1:EgBe8VcdPwmxbSz gitea.pena/PenaSide/common v0.0.0-20250103085335-91ea31fee517/go.mod h1:91EuBCgcqgJ6mG36n2pds8sPwwfaJytLWOzY3h2YFKU= gitea.pena/PenaSide/hlog v0.0.0-20241125221102-a54c29c002a9 h1:tBkXWNIt8icmkMMnq8MA421RWkUy4OZh5P7C3q8uCu4= gitea.pena/PenaSide/hlog v0.0.0-20241125221102-a54c29c002a9/go.mod h1:sanhSL8aEsfcq21P+eItYiAnKAre+B67nGJmDfk2cf0= -gitea.pena/PenaSide/linters-golang v0.0.0-20241119212350-2759fa93724a h1:UySqMgaOKNsR42Y6GQXoM2wn/waYNc9cakMUSvbEEAg= -gitea.pena/PenaSide/linters-golang v0.0.0-20241119212350-2759fa93724a/go.mod h1:gdd+vOT6up9STkEbxa2qESLIMZFjCmRbkcheFQCVgZU= gitea.pena/PenaSide/linters-golang v0.0.0-20241207122018-933207374735 h1:jDVeUhGBTXBibmW5dmtJg2m2+z5z2Rf6J4G0LpjVoJ0= gitea.pena/PenaSide/linters-golang v0.0.0-20241207122018-933207374735/go.mod h1:gdd+vOT6up9STkEbxa2qESLIMZFjCmRbkcheFQCVgZU= gitea.pena/PenaSide/trashlog v0.0.0-20250224122049-ddb4d72e9d07 h1:bUIUgzXQt16aBqSccI//BaODpRCTIaqlddSepM98QSc= gitea.pena/PenaSide/trashlog v0.0.0-20250224122049-ddb4d72e9d07/go.mod h1:GRfWJerTUlgy82CiYAxE4tVYSVV54zEJJQy17Fx46E4= -gitea.pena/SQuiz/common v0.0.0-20250207214652-9994f2d4d43f h1:458FCN98jVkjAqg3yyspgkUdJnKz3BNMiZosrVtPpv8= -gitea.pena/SQuiz/common v0.0.0-20250207214652-9994f2d4d43f/go.mod h1:/YR+uo4RouZshuHPkguk7nAJVKuFt3Z0mTFxUPdlzxQ= -gitea.pena/SQuiz/common v0.0.0-20250408124416-0d7939901586 h1:TDezSbQIU+zqteZQPCV8t5PBGRljNZQpmGiO3rdpiPY= -gitea.pena/SQuiz/common v0.0.0-20250408124416-0d7939901586/go.mod h1:/YR+uo4RouZshuHPkguk7nAJVKuFt3Z0mTFxUPdlzxQ= -gitea.pena/SQuiz/common v0.0.0-20250416223244-494c0a8d6de9 h1:PIF9heSMNLBmI2imvuLJ91dYqIsE1NMRVVuUD7Dg/Cw= -gitea.pena/SQuiz/common v0.0.0-20250416223244-494c0a8d6de9/go.mod h1:/YR+uo4RouZshuHPkguk7nAJVKuFt3Z0mTFxUPdlzxQ= -gitea.pena/SQuiz/common v0.0.0-20250416231920-c2702e984b37 h1:xam4cv0KdGRoXZw2vM7SUY7e1rSHAC4Kn08PWQIftnY= -gitea.pena/SQuiz/common v0.0.0-20250416231920-c2702e984b37/go.mod h1:/YR+uo4RouZshuHPkguk7nAJVKuFt3Z0mTFxUPdlzxQ= -gitea.pena/SQuiz/common v0.0.0-20250425155255-ad4095b7c130 h1:E+l9MG6Iqeb4+4nW3rG5o0EgwvnJvlb45IzDTKiotCY= -gitea.pena/SQuiz/common v0.0.0-20250425155255-ad4095b7c130/go.mod h1:/YR+uo4RouZshuHPkguk7nAJVKuFt3Z0mTFxUPdlzxQ= +gitea.pena/SQuiz/common v0.0.0-20250514124515-870e52266ca5 h1:C+iCsGMSUJonOTNNk8wWYOfzZ0Jjw+2IQ5FaEGwRVT0= +gitea.pena/SQuiz/common v0.0.0-20250514124515-870e52266ca5/go.mod h1:zCrUwDh0APpztKk6NUqTZv+zhjVbWpGBJiJ5z9dAH0U= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/ClickHouse/clickhouse-go v1.5.4 h1:cKjXeYLNWVJIx2J1K6H2CqyRmfwVJVY1OV1coaaFcI0= github.com/ClickHouse/clickhouse-go v1.5.4/go.mod h1:EaI/sW7Azgz9UATzd5ZdZHRUhHgv5+JMS9NSr2smCJI= @@ -113,7 +103,6 @@ github.com/skeris/appInit v1.0.2/go.mod h1:4ElEeXWVGzU3dlYq/eMWJ/U5hd+LKisc1z3+y github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tealeg/xlsx v1.0.5 h1:+f8oFmvY8Gw1iUXzPk+kz+4GpbDZPK1FhPiQRd+ypgE= diff --git a/service/service.go b/service/service.go index e52dcb1..d444dd8 100644 --- a/service/service.go +++ b/service/service.go @@ -75,6 +75,7 @@ type GetQuizDataReq struct { Limit uint64 `json:"limit"` Page uint64 `json:"page"` NeedConfig bool `json:"need_config"` // true if you need not only question page + Auditory int64 `json:"auditory"` } // GetQuizDataResp response with prepared data for user @@ -177,7 +178,7 @@ func (s *Service) GetQuizData(c *fiber.Ctx) error { var cnt uint64 if quiz.Status == model.StatusAI { - questions, cnt, err = s.dal.QuestionRepo.GetQuestionsAI(c.Context(), int64(quiz.Id), cs, int32(req.Limit), int32(req.Page*req.Limit)) + questions, cnt, err = s.dal.QuestionRepo.GetQuestionsAI(c.Context(), int64(quiz.Id), cs, int32(req.Limit), int32(req.Page*req.Limit), req.Auditory) if err != nil { return c.Status(fiber.StatusInternalServerError).SendString(err.Error()) } @@ -186,7 +187,7 @@ func (s *Service) GetQuizData(c *fiber.Ctx) error { c.Context(), req.Limit, req.Page*req.Limit, - 0, 0, quiz.Id, false, false, "", "", + 0, 0, quiz.Id, false, false, "", "", req.Auditory, ) if err != nil { return c.Status(fiber.StatusInternalServerError).SendString(err.Error())