From 09bc86da0268b5cbe07686b5b03680d2b7146a0c Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Sun, 28 Jul 2024 01:50:05 +0800 Subject: [PATCH] :alembic: Basic featuring recommendation algorithm --- pkg/internal/server/api/recommendation_api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/internal/server/api/recommendation_api.go b/pkg/internal/server/api/recommendation_api.go index e7b1560..e58fbc8 100644 --- a/pkg/internal/server/api/recommendation_api.go +++ b/pkg/internal/server/api/recommendation_api.go @@ -36,7 +36,7 @@ func listRecommendationFeatured(c *fiber.Ctx) error { return fiber.NewError(fiber.StatusInternalServerError, err.Error()) } - items, err := services.ListPost(tx, take, offset, "published_at DESC") + items, err := services.ListPost(tx, take, offset, "published_at DESC, (COALESCE(total_upvote, 0) - COALESCE(total_downvote, 0)) DESC") if err != nil { return fiber.NewError(fiber.StatusBadRequest, err.Error()) }