This is an automated email from the ASF dual-hosted git repository. linkinstar pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
commit b9fb758910ae0ce730884e39f4001716fd6eb17b Author: LinkinStars <[email protected]> AuthorDate: Tue Nov 19 18:33:57 2024 +0800 feat(question): sort questions by update time for frequent tab --- internal/repo/question/question_repo.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/internal/repo/question/question_repo.go b/internal/repo/question/question_repo.go index e1d94f2e..9b1d212e 100644 --- a/internal/repo/question/question_repo.go +++ b/internal/repo/question/question_repo.go @@ -411,7 +411,7 @@ func (qr *questionRepo) GetQuestionPage(ctx context.Context, page, pageSize int, session.Where("question.answer_count = 0") session.OrderBy("question.pin desc,question.created_at DESC") case "frequent": - session.OrderBy("question.pin DESC, question.linked_count DESC") + session.OrderBy("question.pin DESC, question.linked_count DESC, question.updated_at DESC") } total, err = pager.Help(page, pageSize, &questionList, &entity.Question{}, session) @@ -823,7 +823,7 @@ func (qr *questionRepo) GetQuestionLink(ctx context.Context, page, pageSize int, session.Where("question.answer_count = 0") session.OrderBy("question.pin desc,question.created_at DESC") case "frequent": - session.OrderBy("question.pin DESC, question.linked_count DESC") + session.OrderBy("question.pin DESC, question.linked_count DESC, question.updated_at DESC") } if page > 0 && pageSize > 0 {
