timeLogController.py 文件源码

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

项目:metronus 作者: Metronus 项目源码 文件源码
def __init__(self, task, month, year, employee):
        total_duration = 0
        self.id = task.id
        self.name = task.name
        self.durations = [(0, 0) for _ in range(0, calendar.monthrange(year, month)[1])]
        time_logs = TimeLog.objects.filter(workDate__year__gte=year,
                                           workDate__month__gte=month,
                                           workDate__year__lte=year,
                                           workDate__month__lte=month,
                                           task_id=task.id,
                                           employee_id=employee)

        for tl in time_logs:
            index = int(tl.workDate.day)-1
            self.durations[index] = (tl.duration, tl.id)
            total_duration += tl.duration
        self.durations.append((total_duration, 0))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号