fallback if user has no events

This commit is contained in:
j 2018-01-22 23:47:22 +01:00
parent cecd4f770f
commit af93e105cd

View file

@ -49,7 +49,7 @@ class Engine:
playlists = playlists[channels['keywords']:] playlists = playlists[channels['keywords']:]
# Count tags for the user # Count tags for the user
count = {} count = {}
for event in user['events']: for event in user.get('events', []):
if 'product' in event['data']: if 'product' in event['data']:
count[event['data']['product']] = count.get( count[event['data']['product']] = count.get(
event['data']['product'], 0 event['data']['product'], 0