Compare commits

...

2 commits

Author SHA1 Message Date
j
a44e619d09 wait for pandora 2018-01-22 23:47:44 +01:00
j
af93e105cd fallback if user has no events 2018-01-22 23:47:44 +01:00
2 changed files with 2 additions and 1 deletions

View file

@ -7,6 +7,7 @@ Restart=always
User=dd User=dd
Group=dd Group=dd
WorkingDirectory=/srv/dd/re WorkingDirectory=/srv/dd/re
ExecStartPre=/usr/bin/wait-for-it -h pandora.dmp -p 80
ExecStart=/srv/dd/re/server.py ExecStart=/srv/dd/re/server.py
[Install] [Install]

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