have process-polls properly handle global_name = null
This commit is contained in:
parent
890796c76d
commit
a1c85c3d28
1 changed files with 7 additions and 1 deletions
|
@ -67,8 +67,14 @@ for row in rows:
|
||||||
voters_1 = get_all_voters(s, row[4], row[5], answer_list_1[0]['answer_id'])
|
voters_1 = get_all_voters(s, row[4], row[5], answer_list_1[0]['answer_id'])
|
||||||
voters_2 = get_all_voters(s, row[4], row[5], answer_list_2[0]['answer_id'])
|
voters_2 = get_all_voters(s, row[4], row[5], answer_list_2[0]['answer_id'])
|
||||||
|
|
||||||
|
def user_to_params(user):
|
||||||
|
name = user['global_name']
|
||||||
|
if name is None:
|
||||||
|
name = user['username']
|
||||||
|
return (user['id'], name, user['avatar'], the_time)
|
||||||
|
|
||||||
cur.executemany('INSERT OR REPLACE INTO users VALUES(?, ?, ?, ?)',
|
cur.executemany('INSERT OR REPLACE INTO users VALUES(?, ?, ?, ?)',
|
||||||
list(map(lambda x: (x['id'], x['global_name'], x['avatar'], the_time), voters_1 + voters_2)))
|
list(map(user_to_params, voters_1 + voters_2)))
|
||||||
|
|
||||||
cur.execute('''
|
cur.execute('''
|
||||||
UPDATE polls
|
UPDATE polls
|
||||||
|
|
Loading…
Add table
Reference in a new issue