only count events with product
This commit is contained in:
parent
935ea07559
commit
49e045daf4
1 changed files with 2 additions and 1 deletions
|
@ -65,7 +65,8 @@ class Engine:
|
|||
# Count tags for the user
|
||||
count = defaultdict(lambda: 0)
|
||||
for event in user.get('events', []):
|
||||
count[event['data']['product']] += 1
|
||||
if event.get('data', {}).get('product'):
|
||||
count[event['data']['product']] += 1
|
||||
# For each tag in playlist, increment score by count
|
||||
for playlist in playlists:
|
||||
score[playlist['name']] = random.random()
|
||||
|
|
Loading…
Reference in a new issue