Beispiel #1
0
 def create_self_assessment_tasks_old_partners():
     # TODO: fill in logic notes
     # Query all SP who joined 23 months ago and beyond
     # Create an SP task for each of those who are exactly 23 mos., 35 mos., 47 mos., ...
     # (for loop: get join date, subtract from today's date, subtract 11 mos, answer should be % 12 == 0)
     today = datetime.date.now()
     a23_months_ago = today - relativedelta.relativedelta(months=24) - datetime.timedelta(days=30)
     partners = SellingPartner.query(SellingPartner.date_joined >= a23_months_ago).fetch(keys_only=True)
     for partner_key in partners:
         partner = partner_key.get()
         # (today - partner.date_joined).days
         TaskSvc.create_self_assessment_task(partner_key)
Beispiel #2
0
    def create_self_assessment_tasks_new_partners():

        def process(partners):
            for partner_key in partners:
                TaskSvc.create_self_assessment_task(partner_key)

        today = datetime.date.now()
        previous_dates = []
        previous_dates.append(today - relativedelta.relativedelta(months=3) - datetime.timedelta(days=30))
        previous_dates.append(today - relativedelta.relativedelta(months=8) - datetime.timedelta(days=30))
        previous_dates.append(today - relativedelta.relativedelta(months=9) - datetime.timedelta(days=30))
        previous_dates.append(today - relativedelta.relativedelta(months=12) - datetime.timedelta(days=30))
        for d in previous_dates:
            partners = SellingPartner.query(SellingPartner.date_joined == d).fetch(keys_only=True)
            process(partners)