diff options
Diffstat (limited to 'internal/database')
-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 |