Exemple #1
0
def get_saveforlater(quest_sn: int):

    saveforlater = drecall(ts_quest_saveforlater(quest_sn=quest_sn))
    if not saveforlater:
        return None

    return saveforlater
Exemple #2
0
def put_saveforlater(quest_sn: int, json_arg):
    """创建或保存试题"""

    status = bool(json_arg['status']) # true or false
    if status:
        old_sfl = drecall(ts_quest_saveforlater(quest_sn=quest_sn))

        new_sfl = ts_quest_saveforlater(quest_sn=quest_sn)

        new_sfl.updated_ts = datetime.utcnow() if status else None
        dmerge(new_sfl, old_sfl)

        return new_sfl
    else:
        dbc << """
        DELETE FROM ts_quest_saveforlater
        WHERE quest_sn = %(quest_sn)s
        """
        dbc << dict(quest_sn=quest_sn)

        return None