controller.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:chronophore 作者: mesbahamin 项目源码 文件源码
def flag_forgotten_entries(session, today=None):
    """Flag any entries from previous days where users forgot to sign
    out.

    :param session: SQLAlchemy session through which to access the database.
    :param today: (optional) The current date as a `datetime.date` object. Used for testing.
    """ # noqa
    today = date.today() if today is None else today

    forgotten = (
        session
        .query(Entry)
        .filter(Entry.time_out.is_(None))
        .filter(Entry.forgot_sign_out.is_(False))
        .filter(Entry.date < today)
    )

    for entry in forgotten:
        e = sign_out(entry, forgot=True)
        logger.debug('Signing out forgotten entry: {}'.format(e))
        session.add(e)

    session.commit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号