Temorarily disable user action in cluster (recommendation system)Unverified
4c84177 parent: 76c617b modified
internal/cluster/dismiss.go +4 -0 | @@ -11,6 +11,7 @@ type Impression struct { | ||
| 11 | 11 | } |
| 12 | 12 | |
| 13 | 13 | func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason string) error { |
| 14 | + return nil | |
| 14 | 15 | _, err := e.db.ExecContext(ctx, ` |
| 15 | 16 | INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason) |
| 16 | 17 | VALUES (?, 'feed', ?, ?) |
| @@ -20,6 +21,7 @@ func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason strin | ||
| 20 | 21 | } |
| 21 | 22 | |
| 22 | 23 | func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason string) error { |
| 24 | + return nil | |
| 23 | 25 | _, err := e.db.ExecContext(ctx, ` |
| 24 | 26 | INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason) |
| 25 | 27 | VALUES (?, 'article', ?, ?) |
| @@ -29,6 +31,7 @@ func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason | ||
| 29 | 31 | } |
| 30 | 32 | |
| 31 | 33 | func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressions []Impression) error { |
| 34 | + return nil | |
| 32 | 35 | tx, err := e.db.BeginTx(ctx, nil) |
| 33 | 36 | if err != nil { |
| 34 | 37 | return err |
| @@ -51,6 +54,7 @@ func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressi | ||
| 51 | 54 | } |
| 52 | 55 | |
| 53 | 56 | func (e *Engine) MarkImpressionActed(ctx context.Context, userDID, targetType, targetID string) error { |
| 57 | + return nil | |
| 54 | 58 | _, err := e.db.ExecContext(ctx, ` |
| 55 | 59 | UPDATE recs.recommendation_impressions SET acted = 1 |
| 56 | 60 | WHERE user_did = ? AND target_type = ? AND target_id = ? |
| @@ -11,6 +11,7 @@ type Impression struct { | |||
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason string) error { | 13 | func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason string) error { |
| 14 | + return nil | ||
| 14 | _, err := e.db.ExecContext(ctx, ` | 15 | _, err := e.db.ExecContext(ctx, ` |
| 15 | INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason) | 16 | INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason) |
| 16 | VALUES (?, 'feed', ?, ?) | 17 | VALUES (?, 'feed', ?, ?) |
| @@ -20,6 +21,7 @@ func (e *Engine) DismissFeed(ctx context.Context, userDID, feedURL, reason strin | |||
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason string) error { | 23 | func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason string) error { |
| 24 | + return nil | ||
| 23 | _, err := e.db.ExecContext(ctx, ` | 25 | _, err := e.db.ExecContext(ctx, ` |
| 24 | INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason) | 26 | INSERT INTO recs.dismissed_recommendations (user_did, target_type, target_id, reason) |
| 25 | VALUES (?, 'article', ?, ?) | 27 | VALUES (?, 'article', ?, ?) |
| @@ -29,6 +31,7 @@ func (e *Engine) DismissArticle(ctx context.Context, userDID, articleURL, reason | |||
| 29 | } | 31 | } |
| 30 | 32 | ||
| 31 | func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressions []Impression) error { | 33 | func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressions []Impression) error { |
| 34 | + return nil | ||
| 32 | tx, err := e.db.BeginTx(ctx, nil) | 35 | tx, err := e.db.BeginTx(ctx, nil) |
| 33 | if err != nil { | 36 | if err != nil { |
| 34 | return err | 37 | return err |
| @@ -51,6 +54,7 @@ func (e *Engine) RecordImpressions(ctx context.Context, userDID string, impressi | |||
| 51 | } | 54 | } |
| 52 | 55 | ||
| 53 | func (e *Engine) MarkImpressionActed(ctx context.Context, userDID, targetType, targetID string) error { | 56 | func (e *Engine) MarkImpressionActed(ctx context.Context, userDID, targetType, targetID string) error { |
| 57 | + return nil | ||
| 54 | _, err := e.db.ExecContext(ctx, ` | 58 | _, err := e.db.ExecContext(ctx, ` |
| 55 | UPDATE recs.recommendation_impressions SET acted = 1 | 59 | UPDATE recs.recommendation_impressions SET acted = 1 |
| 56 | WHERE user_did = ? AND target_type = ? AND target_id = ? | 60 | WHERE user_did = ? AND target_type = ? AND target_id = ? |
modified
internal/cluster/weights.go +2 -0 | @@ -12,10 +12,12 @@ const ( | ||
| 12 | 12 | ) |
| 13 | 13 | |
| 14 | 14 | func (e *Engine) RewardSignal(ctx context.Context, userDID string, signal string) { |
| 15 | + return | |
| 15 | 16 | e.adjustWeight(ctx, userDID, signal, 1.0) |
| 16 | 17 | } |
| 17 | 18 | |
| 18 | 19 | func (e *Engine) PenalizeSignal(ctx context.Context, userDID string, signal string) { |
| 20 | + return | |
| 19 | 21 | e.adjustWeight(ctx, userDID, signal, -1.0) |
| 20 | 22 | } |
| 21 | 23 | |
| @@ -12,10 +12,12 @@ const ( | |||
| 12 | ) | 12 | ) |
| 13 | 13 | ||
| 14 | func (e *Engine) RewardSignal(ctx context.Context, userDID string, signal string) { | 14 | func (e *Engine) RewardSignal(ctx context.Context, userDID string, signal string) { |
| 15 | + return | ||
| 15 | e.adjustWeight(ctx, userDID, signal, 1.0) | 16 | e.adjustWeight(ctx, userDID, signal, 1.0) |
| 16 | } | 17 | } |
| 17 | 18 | ||
| 18 | func (e *Engine) PenalizeSignal(ctx context.Context, userDID string, signal string) { | 19 | func (e *Engine) PenalizeSignal(ctx context.Context, userDID string, signal string) { |
| 20 | + return | ||
| 19 | e.adjustWeight(ctx, userDID, signal, -1.0) | 21 | e.adjustWeight(ctx, userDID, signal, -1.0) |
| 20 | } | 22 | } |
| 21 | 23 | ||