This is an automated email from the ASF dual-hosted git repository.

linkinstar pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/answer.git


The following commit(s) were added to refs/heads/dev by this push:
     new d8ab25d5 fix: dedup questions in GetQuestionPage
d8ab25d5 is described below

commit d8ab25d5653d51bf7b143e5415b7c7fabe0189ac
Author: hgaol <[email protected]>
AuthorDate: Tue Apr 15 22:03:20 2025 +0800

    fix: dedup questions in GetQuestionPage
---
 internal/repo/question/question_repo.go | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/internal/repo/question/question_repo.go 
b/internal/repo/question/question_repo.go
index d13cf193..3935e610 100644
--- a/internal/repo/question/question_repo.go
+++ b/internal/repo/question/question_repo.go
@@ -404,6 +404,7 @@ func (qr *questionRepo) GetQuestionPage(ctx 
context.Context, page, pageSize int,
        if showPending {
                status = append(status, entity.QuestionStatusPending)
        }
+       session.Select("question.*")
        session.In("question.status", status)
        if len(tagIDs) > 0 {
                session.Join("LEFT", "tag_rel", "question.id = 
tag_rel.object_id")
@@ -442,6 +443,7 @@ func (qr *questionRepo) GetQuestionPage(ctx 
context.Context, page, pageSize int,
                session.OrderBy("question.pin DESC, question.linked_count DESC, 
question.updated_at DESC")
        }
 
+       session.GroupBy("question.id")
        total, err = pager.Help(page, pageSize, &questionList, 
&entity.Question{}, session)
        if err != nil {
                err = 
errors.InternalServer(reason.DatabaseError).WithError(err).WithStack()

Reply via email to