Add a command for backdating switches

This commit is contained in:
Ske
2018-07-20 22:56:32 +02:00
parent acb11dd9d6
commit 26d89136b1
4 changed files with 85 additions and 2 deletions

View File

@@ -214,6 +214,11 @@ async def add_switch(conn, system_id: int):
res = await conn.fetchrow("insert into switches (system) values ($1) returning *", system_id)
return res["id"]
@db_wrap
async def move_last_switch(conn, system_id: int, switch_id: int, new_time):
logger.debug("Moving latest switch (system={}, id={}, new_time={})".format(system_id, switch_id, new_time))
await conn.execute("update switches set timestamp = $1 where system = $2 and id = $3", new_time, system_id, switch_id)
@db_wrap
async def add_switch_member(conn, switch_id: int, member_id: int):
logger.debug("Adding switch member (switch={}, member={})".format(switch_id, member_id))