def update_done_by_id(db, req_id, done): # generate an update string on the done field with id as where q_str = db_helpers.update_where_string(TABLE_NAME, FIELD_DONE, FIELD_REQUESTID) # and execute it c = db.cursor() c.execute(q_str, [done, req_id]) db.commit()
def update_results_by_id(db, req_id, results): # generate an update string on the results field with id as where q_str = db_helpers.update_where_string(TABLE_NAME, FIELD_RESULTS, FIELD_REQUESTID) # and execute it c = db.cursor() c.execute(q_str, [results, req_id]) db.commit()
def update_in_progress_by_id(db, req_id, in_progress): # generate an update string on the in progress field with id as where q_str = db_helpers.update_where_string(TABLE_NAME, FIELD_INPROGRESS, FIELD_REQUESTID) # and execute it c = db.cursor() c.execute(q_str, [in_progress, req_id]) db.commit()
def reset_pass_hash(db, email, pass_hash): if email is None: return None q_str = db_helpers.update_where_string(TABLE_NAME, FIELD_PASSHASH, FIELD_EMAIL) c = db.cursor() c.execute(q_str, [pass_hash, email]) db.commit()
def update_last_login(db, email): if email is None: return None last_login = datetime.datetime.utcnow().isoformat() q_str = db_helpers.update_where_string(TABLE_NAME, FIELD_LASTLOGIN, FIELD_EMAIL) c = db.cursor() c.execute(q_str, [last_login, email]) db.commit()
def update_complete_time_to_utc_now_by_id(db, req_id): # generate an update string on the complete time field with id as where q_str = db_helpers.update_where_string(TABLE_NAME, FIELD_COMPLETETIME, FIELD_REQUESTID) # get the current time in UTC complete_time = datetime.datetime.utcnow().isoformat() # and execute it c = db.cursor() c.execute(q_str, [complete_time, req_id]) db.commit()
def create_guest_user_account(db, email, pass_hash): # start with a standard creation user = create_user_account(db, email, pass_hash) # and mark the account as a guest q_str = db_helpers.update_where_string(TABLE_NAME, FIELD_GUESTACCOUNT, FIELD_EMAIL) c = db.cursor() c.execute(q_str, [True, email]) db.commit() return get_one_by_email(db, email)