user.py 文件源码

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

项目:PhoenixNow 作者: ECGHelloWorld 项目源码 文件源码
def monthly_checkins(year_num, month_num, user):
    month_range = calendar.monthrange(year_num, month_num)
    month = [False] * month_range[1]

    start_of_month = datetime.date(year_num, month_num, 1)

    checkins = Checkin.query.filter(Checkin.user==user, Checkin.checkin_timestamp>=start_of_month).order_by('Checkin.checkin_timestamp')

    for checkin in checkins:
        if checkin.checkin_timestamp.date().month == month_num:
            if checkin.checkin_timestamp.date().year == year_num:
                month[checkin.checkin_timestamp.date().day - 1] = True

    return month
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号