diff options
author | GrailFinder <wohilas@gmail.com> | 2024-06-05 08:22:36 +0300 |
---|---|---|
committer | GrailFinder <wohilas@gmail.com> | 2024-06-05 08:22:36 +0300 |
commit | 01f9a9f5d71450a0c80195058245fdebe88796bd (patch) | |
tree | fd50f3fdd0585fd1ff6cf431af613fa01b86e439 /internal/database/repos/action.go | |
parent | 60fc1773241195f4988ed8066e019bbc42267085 (diff) |
Feat: recommendations for anon and user
Diffstat (limited to 'internal/database/repos/action.go')
-rw-r--r-- | internal/database/repos/action.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/database/repos/action.go b/internal/database/repos/action.go index ab1f559..38253bc 100644 --- a/internal/database/repos/action.go +++ b/internal/database/repos/action.go @@ -8,15 +8,15 @@ type ActionRepo interface { DBActionGetByName(name string) (*models.Action, error) DBActionDone(name string) error DBActionsToReset() error - DBActionRecommend(username string, at models.ActionType) ([]models.Action, error) + DBActionRecommend(username string) ([]models.Action, error) } func (p *Provider) DBActionRecommend( - username string, at models.ActionType, + username string, ) ([]models.Action, error) { resp := []models.Action{} - query := `SELECT * FROM action WHERE username!=$1 AND type=$2 GROUP BY name LIMIT 5;` - if err := p.db.Select(&resp, query, username, at); err != nil { + query := `SELECT * FROM action WHERE name NOT IN (select name from action where username == $1) GROUP BY name LIMIT 100;` + if err := p.db.Select(&resp, query, username); err != nil { return nil, err } return resp, nil |