refactor: use dict.update()
This commit is contained in:
parent
ec01c74da1
commit
f3c884111d
1 changed files with 4 additions and 6 deletions
|
|
@ -467,17 +467,15 @@ async def update_payment_extra(
|
||||||
)
|
)
|
||||||
if not row:
|
if not row:
|
||||||
return
|
return
|
||||||
existing_extra = json.loads(row["extra"] if row["extra"] else "{}")
|
db_extra = json.loads(row["extra"] if row["extra"] else "{}")
|
||||||
new_extra = {
|
db_extra.update(extra)
|
||||||
**existing_extra,
|
|
||||||
**extra,
|
|
||||||
}
|
|
||||||
await (conn or db).execute(
|
await (conn or db).execute(
|
||||||
"""
|
"""
|
||||||
UPDATE apipayments SET extra = ?
|
UPDATE apipayments SET extra = ?
|
||||||
WHERE hash = ?
|
WHERE hash = ?
|
||||||
""",
|
""",
|
||||||
(json.dumps(new_extra), payment_hash),
|
(json.dumps(db_extra), payment_hash),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue