This is an automated email from the ASF dual-hosted git repository.
linkinstar pushed a commit to branch feat/1.4.2/tag
in repository https://gitbox.apache.org/repos/asf/incubator-answer.git
The following commit(s) were added to refs/heads/feat/1.4.2/tag by this push:
new 5866197c feat(question): sort questions by update time for frequent tab
5866197c is described below
commit 5866197c5cdcf50c36e803c403d08ce21b5a4c7e
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 {