dailycheck.py 文件源码

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

项目:BackendAllStars 作者: belatrix 项目源码 文件源码
def evaluate_block_users(self):
        employees = get_list_or_404(Employee)
        for employee in employees:
            if employee.yesterday_given > config.MAX_STARS_GIVEN_DAY:
                employee.is_blocked = True
            if employee.yesterday_received > config.MAX_STARS_RECEIVED_DAY:
                employee.is_blocked = True
            if employee.current_month_given > config.MAX_STARS_GIVEN_MONTHLY:
                employee.is_blocked = True
            if employee.current_month_score > config.MAX_STARS_RECEIVED_MONTHLY:
                employee.is_blocked = True
            employee.save()

            try:
                if employee.is_blocked:
                    self.send_blocked_notification_email(employee)
                    send_push_notification(employee, config.USER_BLOCKED_NOTIFICATION_MESSAGE % employee.username)
            except Exception as e:
                print(e)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号