Add new flags.
This commit is contained in:
parent
ef214535dd
commit
ba919f8e0a
14
words.py
14
words.py
|
@ -46,14 +46,20 @@ while Q:
|
|||
)
|
||||
resp.raise_for_status()
|
||||
|
||||
z = resp.json()['result']
|
||||
log.info('%s (%d) + %s (%d) -> %s', x, x_rank, y, y_rank, z)
|
||||
response = resp.json()
|
||||
z = response['result']
|
||||
is_new = response['isNew']
|
||||
log.info(
|
||||
'%s (%d) + %s (%d) -> %s%s',
|
||||
x, x_rank, y, y_rank, z,
|
||||
' [NEW!]' if is_new else ''
|
||||
)
|
||||
|
||||
z_rank = 1+max(x_rank, y_rank)
|
||||
db.execute('''
|
||||
insert into words (word, rank) values (?, ?)
|
||||
insert into words (word, rank, is_new) values (?, ?, ?)
|
||||
on conflict(word) do update set rank = ? where rank > ?
|
||||
''', (z, z_rank, z_rank, z_rank))
|
||||
''', (z, z_rank, is_new, z_rank, z_rank))
|
||||
|
||||
db.executemany(
|
||||
'insert or ignore into combos (x, y, z) values (?, ?, ?)',
|
||||
|
|
Loading…
Reference in New Issue