refactor: use dict.update()
This commit is contained in:
+4
-6
@@ -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),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user