From dda0687b1a1763cb5c14f1b97f737b519677c5fa Mon Sep 17 00:00:00 2001 From: LittleSheep Date: Tue, 23 Jul 2024 17:33:17 +0800 Subject: [PATCH] :bug: Fix buggy recommendation query statement --- pkg/internal/server/api/recommendation_api.go | 4 ++-- settings.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/internal/server/api/recommendation_api.go b/pkg/internal/server/api/recommendation_api.go index cc3513b..1e67001 100644 --- a/pkg/internal/server/api/recommendation_api.go +++ b/pkg/internal/server/api/recommendation_api.go @@ -14,7 +14,7 @@ func listRecommendationDefault(c *fiber.Ctx) error { realmId := c.QueryInt("realmId", 0) maxDownVote := c.QueryInt("maxDownVote", 3) - tx := database.C.Joins("Author").Where("accounts.total_downvote <= ?", maxDownVote) + tx := database.C.Joins("Author").Where("\"Author\".total_downvote <= ?", maxDownVote) tx = services.FilterPostDraft(tx) if realmId > 0 { if realm, err := services.GetRealmWithExtID(uint(realmId)); err != nil { @@ -47,7 +47,7 @@ func listRecommendationShuffle(c *fiber.Ctx) error { realmId := c.QueryInt("realmId", 0) maxDownVote := c.QueryInt("maxDownVote", 3) - tx := database.C.Joins("Author").Where("accounts.total_downvote <= ?", maxDownVote) + tx := database.C.Joins("Author").Where("\"Author\".total_downvote <= ?", maxDownVote) tx = services.FilterPostDraft(tx) if realmId > 0 { if realm, err := services.GetRealmWithExtID(uint(realmId)); err != nil { diff --git a/settings.toml b/settings.toml index 4321674..13bb7ca 100644 --- a/settings.toml +++ b/settings.toml @@ -6,7 +6,7 @@ domain = "im.solsynth.dev" secret = "LtTjzAGFLshwXhN4ZD4nG5KlMv1MWcsvfv03TSZYnT1VhiAnLIZFTnHUwR0XhGgi" [debug] -database = false +database = true print_routes = false [dealer]