Esempio n. 1
0
def deal_sign_in(account_id, current_date, sign_time, manual_flag=False):
    content = get_status_by_user(account_id, current_date)

    if content is not None:
        status = content[0]
        process = content[1]
        if status == "in_done" or process is not None:
            return invalid_message()

    return deal_sign_in_message(sign_time, manual_flag)
Esempio n. 2
0
def manual_sign_out_content(account_id, current_date):

    yield asyncio.sleep(1)
    content = get_status_by_user(account_id, current_date)

    if content is None or content[1] is None or content[1] != "sign_in_done":
        return [invalid_message()]

    set_status_by_user_date(account_id, current_date, "wait_out")

    return manual_sign_out_message()
def manual_sign_in_content(account_id, current_date):
    yield asyncio.sleep(1)

    content = get_status_by_user(account_id, current_date)

    if content is not None and content[1] is not None:
        return [invalid_message()]

    insert_replace_status_by_user_date(account_id, current_date, "wait_in")

    return manual_sign_in_message()
Esempio n. 4
0
def sign_in_content(account_id, current_date):

    content = get_status_by_user(account_id, current_date)
    process = None
    if content is not None:
        status = content[0]
        process = content[1]
        if status == "wait_in":
            delete_status_by_user_date(account_id, current_date)

    if process is not None:
        return reminder_message("sign_in_done")

    return sign_in_message()
Esempio n. 5
0
def sign_out_content(account_id, current_date):

    content = get_status_by_user(account_id, current_date)
    process = None
    if content is not None:
        status = content[0]
        process = content[1]
        if status == "wait_out":
            set_status_by_user_date(account_id, current_date, status="in_done")

    if process is None or process != "sign_in_done":
        return reminder_message(None)

    return sign_out_message()
def manual_sign_out_content(account_id, current_date):
    """
    Update user status and generate manual check-out message.

    :param account_id: user account id
    :param current_date: current date by local time.
    :return: message content list
    """
    yield asyncio.sleep(1)
    content = get_status_by_user(account_id, current_date)

    if content is None or content[1] is None or content[1] != "sign_in_done":
        return [invalid_message()]

    set_status_by_user_date(account_id, current_date, "wait_out")

    return manual_sign_out_message()
Esempio n. 7
0
def manual_sign_in_content(account_id, current_date):
    """
    Update user status and generate manual check-in message.

    :param account_id: user account id
    :param current_date: current date by local time.
    :return: message content list
    """

    yield asyncio.sleep(1)

    content = get_status_by_user(account_id, current_date)

    if content is not None and content[1] is not None:
        return [invalid_message()]

    insert_replace_status_by_user_date(account_id, current_date, "wait_in")

    return manual_sign_in_message()
Esempio n. 8
0
def sign_out_content(account_id, current_date):
    """
    Update user status and generate check-out message.

    :param account_id: user account id
    :param current_date: current date by local time.
    :return: button type message content
    """

    content = get_status_by_user(account_id, current_date)
    process = None
    if content is not None:
        status = content[0]
        process = content[1]
        if status == "wait_out":
            set_status_by_user_date(account_id, current_date, status="in_done")

    if process is None or process != "sign_in_done":
        return reminder_message(None)

    return sign_out_message()
Esempio n. 9
0
def sign_in_content(account_id, current_date):
    """
    Update user status and generate check-in message.

    :param account_id: user account id
    :param current_date: current date by local time.
    :retrurn: button type message content
    """

    content = get_status_by_user(account_id, current_date)
    process = None
    if content is not None:
        status = content[0]
        process = content[1]
        if status == "wait_in":
            delete_status_by_user_date(account_id, current_date)

    if process is not None:
        return reminder_message("sign_in_done")

    return sign_in_message()