# Try to remove old relation of identifier
# As 'delete or ignore' does not exist, workaround is used
- res = c.execute("select * from identifiers where id = ? and status = ?", (iid, 0, ))
+ res = c.execute("select * from identifiers where id = ? and active = ?", (iid, 0, ))
# This is True when some rows were found before; delete old relation
if res.fetchone():
- res = c.execute("delete from identifiers where id = ? and status = ?", (iid, 0, ))
+ res = c.execute("delete from identifiers where id = ? and active = ?", (iid, 0, ))
# Add new relation
res = c.execute("insert into identifiers (userid, id, name) values (?, ?, ?)", (uid, iid, name, ))
def disable_user_identifier(uid, iid):
conn, c = open_db()
- c.execute("update identifiers set status = ? where userid = ? and id = ?", (0, uid, iid, ))
+ c.execute("update identifiers set active = ? where userid = ? and id = ?", (0, uid, iid, ))
close_db(conn)
def get_name(uid):
def get_uid(iid):
conn, c = open_db()
res = list(c.execute("""
- select userid from identifiers where id = ? and status
+ select userid from identifiers where id = ? and active
""", (iid,)))
close_db(conn)
def list_user_identifiers(uid):
conn, c = open_db()
res = list(c.execute("""
- select * from identifiers where userid = ? and status
+ select * from identifiers where userid = ? and active
""", (uid,)))
close_db(conn)
return res
query += " where date(time) between date('now', 'localtime', '-"+ str(days+start-1) +" days') and date('now', 'localtime', '-"+ str(start) +" days')"
if uid is not None:
- query += " and ids.userid = ? and ids.status"
+ query += " and ids.userid = ? and ids.active"
variables.append(uid)
elif uid is not None:
- query += " where ids.userid = ? and ids.status"
+ query += " where ids.userid = ? and ids.active"
variables.append(uid)
res = list(c.execute("""
select strftime('%s', ds.d),count(c.flavor),c.flavor from
(select num,date('now', 'localtime', -num || ' days') as d from days) ds
left join
- (select date(time, 'localtime') as time,flavor from coffees co left join identifiers ids on co.id = ids.id where ids.userid = ? and ids.status) c
+ (select date(time, 'localtime') as time,flavor from coffees co left join identifiers ids on co.id = ids.id where ids.userid = ? and ids.active) c
on d = date(c.time) group by d, c.flavor
"""
, (uid,)))
clauses = []
if uid is not None:
- clauses.append("ids.userid = ? and ids.status")
+ clauses.append("ids.userid = ? and ids.active")
args.append(uid)
if start is not None: