drewwalters96 / subber

A web-based application that allows active reddit users to discover subreddits based on post history and subscription data.
GNU General Public License v3.0
5 stars 3 forks source link

Ensure a single subreddit suggestion instead of multiple #34

Closed annapankiewicz closed 6 years ago

annapankiewicz commented 6 years ago

Thank you for your contribution to Subber! Please fill out one of the two templates below (issue or feature request).

Issue:

When obtaining subreddit suggestions for a user, repeated suggestions are returned.

Expected behavior:

Only a single suggestion per subreddit should be returned.

Actual behavior:

Multiple suggestions are returned, but the number of repeated suggestions per subreddit varies.

Steps to reproduce the behavior:
  1. Run Subber in a container
  2. Find suggestions for user "agom94"
  3. Observe repeated suggestions:
    • 4 suggestions of r/army
    • 3 suggestions of r/military
    • 2 suggestions of r/pcmasterrace
    • 2 suggestions of r/AskReddit
Relevant logs ('subber.log')

subber.log

drewwalters96 commented 6 years ago

Thank you @annapankiewicz for the bug report. This issue has been confirmed and is being investigated.

drewwalters96 commented 6 years ago

This appears to be happening in reddit.py. It seems that active subs are still being added as duplicates in the user recommendations function after being returned from _get_active_subs()

017-12-28 00:34:42,517    subber.reddit     DEBUG    Processing PRAW comment request results for user SreaminGinger
2017-12-28 00:34:43,338    subber.reddit     DEBUG    Processing PRAW submission requst results for user SreaminGinger
2017-12-28 00:34:43,999    subber.reddit     DEBUG    3 active subs found for user SreaminGinger
2017-12-28 00:34:43,999    subber.reddit     DEBUG    Active subs found for user SreaminGinger as ['r/MilitaryPorn', 'r/Military', 'r/army']
2017-12-28 00:34:46,037    subber.reddit     DEBUG    PRAW comment request made for user eodizzlez
2017-12-28 00:34:46,038    subber.reddit     DEBUG    PRAW submission request made for user eodizzlez
2017-12-28 00:34:46,038    subber.reddit     DEBUG    Processing PRAW comment request results for user eodizzlez
2017-12-28 00:34:46,829    subber.reddit     DEBUG    Processing PRAW submission requst results for user eodizzlez
2017-12-28 00:34:47,507    subber.reddit     DEBUG    5 active subs found for user eodizzlez
2017-12-28 00:34:47,507    subber.reddit     DEBUG    Active subs found for user eodizzlez as ['r/Military', 'r/army', 'r/tifu', 'r/AskReddit', 'r/army']