当前位置: 首页>>代码示例>>Python>>正文


Python EmailTemplate.send_reminder_to_user方法代码示例

本文整理汇总了Python中evap.evaluation.models.EmailTemplate.send_reminder_to_user方法的典型用法代码示例。如果您正苦于以下问题:Python EmailTemplate.send_reminder_to_user方法的具体用法?Python EmailTemplate.send_reminder_to_user怎么用?Python EmailTemplate.send_reminder_to_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在evap.evaluation.models.EmailTemplate的用法示例。


在下文中一共展示了EmailTemplate.send_reminder_to_user方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: handle

# 需要导入模块: from evap.evaluation.models import EmailTemplate [as 别名]
# 或者: from evap.evaluation.models.EmailTemplate import send_reminder_to_user [as 别名]
    def handle(self, *args, **options):
        logger.info("send_reminders called.")
        check_dates = []

        # Collect end-dates of courses whose participants need to be reminded today.
        for number_of_days in settings.REMIND_X_DAYS_AHEAD_OF_END_DATE:
            check_dates.append(datetime.date.today() + datetime.timedelta(days=number_of_days))

        recipients = set()
        for course in Course.objects.filter(state="in_evaluation", vote_end_date__in=check_dates):
            recipients.update(course.due_participants)

        for recipient in recipients:
            due_courses = dict()
            for course in Course.objects.filter(participants=recipient, state="in_evaluation").exclude(
                voters=recipient
            ):
                due_courses[course] = (course.vote_end_date - datetime.date.today()).days
            first_due_in_days = min(due_courses.values())

            # Sort courses by number of days left for evaluation and bring them to following format:
            # [(course, due_in_days), ...]
            due_courses = sorted(due_courses.items(), key=operator.itemgetter(1))

            EmailTemplate.send_reminder_to_user(recipient, first_due_in_days=first_due_in_days, due_courses=due_courses)
        logger.info("send_reminders finished.")
        logger.info("sent reminders to {} people.".format(len(recipients)))
开发者ID:fsr-itse,项目名称:EvaP,代码行数:29,代码来源:send_reminders.py

示例2: check_reminders

# 需要导入模块: from evap.evaluation.models import EmailTemplate [as 别名]
# 或者: from evap.evaluation.models.EmailTemplate import send_reminder_to_user [as 别名]
    def check_reminders(self):
        check_dates = []
        for number_of_days in settings.REMIND_X_DAYS_AHEAD_OF_END_DATE:
            check_dates.append(datetime.date.today() + datetime.timedelta(days=number_of_days))
        
        recipients = set()
        for course in Course.objects.filter(state='inEvaluation', vote_end_date__in=check_dates):
            recipients.update(course.due_participants)

        for recipient in recipients:
            due_courses = list(set(Course.objects.filter(participants=recipient, state='inEvaluation').exclude(voters=recipient)))
            due_in_number_of_days = min((course.vote_end_date - datetime.date.today()).days for course in due_courses)
        
            EmailTemplate.send_reminder_to_user(recipient, due_in_number_of_days=due_in_number_of_days, due_courses=due_courses)
开发者ID:janno42,项目名称:EvaP,代码行数:16,代码来源:run_tasks.py

示例3: handle

# 需要导入模块: from evap.evaluation.models import EmailTemplate [as 别名]
# 或者: from evap.evaluation.models.EmailTemplate import send_reminder_to_user [as 别名]
    def handle(self, *args, **options):
        logger.info("send_reminders called.")
        check_dates = []

        # Collect end-dates of courses whose participants need to be reminded today.
        for number_of_days in settings.REMIND_X_DAYS_AHEAD_OF_END_DATE:
            check_dates.append(datetime.date.today() + datetime.timedelta(days=number_of_days))

        recipients = set()
        for course in Course.objects.filter(state='in_evaluation', vote_end_date__in=check_dates):
            recipients.update(course.due_participants)

        for recipient in recipients:
            due_courses = get_due_courses_for_user(recipient)
            first_due_in_days = due_courses[0][1]  # entry 0 is first due course, entry 1 in tuple is number of days

            EmailTemplate.send_reminder_to_user(recipient, first_due_in_days=first_due_in_days, due_courses=due_courses)
        logger.info("send_reminders finished.")
        logger.info("sent reminders to {} people.".format(len(recipients)))
开发者ID:PFischbeck,项目名称:EvaP,代码行数:21,代码来源:send_reminders.py

示例4: check_reminders

# 需要导入模块: from evap.evaluation.models import EmailTemplate [as 别名]
# 或者: from evap.evaluation.models.EmailTemplate import send_reminder_to_user [as 别名]
    def check_reminders(self):
        logger.info("check_reminders called.")
        check_dates = []
        for number_of_days in settings.REMIND_X_DAYS_AHEAD_OF_END_DATE:
            check_dates.append(datetime.date.today() + datetime.timedelta(days=number_of_days))

        recipients = set()
        for course in Course.objects.filter(state='inEvaluation', vote_end_date__in=check_dates):
            recipients.update(course.due_participants)

        for recipient in recipients:
            due_courses = dict()
            for course in Course.objects.filter(participants=recipient, state='inEvaluation').exclude(voters=recipient):
                due_courses[course] = (course.vote_end_date - datetime.date.today()).days
            first_due_in_days = min(due_courses.values())
            # sort courses by number of days left for evaluation and bring them to following format: [(course, due_in_days), ...]
            due_courses = sorted(due_courses.items(), key=operator.itemgetter(1))

            EmailTemplate.send_reminder_to_user(recipient, first_due_in_days=first_due_in_days, due_courses=due_courses)
        logger.info("check_reminders finished.")
开发者ID:kateyy,项目名称:EvaP,代码行数:22,代码来源:run_tasks.py


注:本文中的evap.evaluation.models.EmailTemplate.send_reminder_to_user方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。