コード例 #1
0
def soh_summary_task():
    """
        6th business day of the month @ 3pm Tanzania time
    """
    now = datetime.utcnow()
    sixth_business_day = get_business_day_of_month(month=now.month, year=now.year, count=6)
    if now.day != sixth_business_day.day:
        return

    for domain in ILSGatewayConfig.get_all_enabled_domains():
        for user in get_district_people(domain):
            send_translated_message(user, REMINDER_MONTHLY_SOH_SUMMARY, **construct_soh_summary(user.location))
コード例 #2
0
def soh_thank_you_task():
    """
    Last business day before the 20th at 4:00 PM Tanzania time
    """
    now = datetime.utcnow()
    business_day = get_business_day_of_month_before(month=now.month, year=now.year, day=20)
    if now.day != business_day.day:
        return

    last_month = datetime(now.year, now.month, 1) - timedelta(days=1)
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        SOHThankYouReminder(domain=domain, date=last_month).send()
コード例 #3
0
ファイル: tasks.py プロジェクト: ye-man/commcare-hq
def soh_summary_task():
    """
        6th business day of the month @ 3pm Tanzania time
    """
    now = datetime.utcnow()
    sixth_business_day = get_business_day_of_month(month=now.month, year=now.year, count=6)
    if now.day != sixth_business_day.day:
        return

    for domain in ILSGatewayConfig.get_all_enabled_domains():
        for user in get_district_people(domain):
            send_translated_message(user, REMINDER_MONTHLY_SOH_SUMMARY, **construct_soh_summary(user.location))
コード例 #4
0
ファイル: tasks.py プロジェクト: yonglehou/commcare-hq
def soh_thank_you_task():
    """
    Last business day before the 20th at 4:00 PM Tanzania time
    """
    now = datetime.utcnow()
    business_day = get_business_day_of_month_before(month=now.month, year=now.year, day=20)
    if now.day != business_day.day:
        return

    last_month = datetime(now.year, now.month, 1) - timedelta(days=1)
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        SOHThankYouReminder(domain=domain, date=last_month).send()
コード例 #5
0
ファイル: tasks.py プロジェクト: ye-man/commcare-hq
def delivery_summary_task():
    """
        last business day of month 3pm Tanzania time
    """
    now = datetime.utcnow()
    last_business_day = get_business_day_of_month(month=now.month, year=now.year, count=-1)
    if now.day != last_business_day.day:
        return

    for domain in ILSGatewayConfig.get_all_enabled_domains():
        for user in get_district_people(domain):
            send_translated_message(
                user, REMINDER_MONTHLY_DELIVERY_SUMMARY, **construct_delivery_summary(user.location)
            )
コード例 #6
0
def delivery_summary_task():
    """
        last business day of month 3pm Tanzania time
    """
    now = datetime.utcnow()
    last_business_day = get_business_day_of_month(month=now.month, year=now.year, count=-1)
    if now.day != last_business_day.day:
        return

    for domain in ILSGatewayConfig.get_all_enabled_domains():
        for user in get_district_people(domain):
            send_translated_message(
                user, REMINDER_MONTHLY_DELIVERY_SUMMARY, **construct_delivery_summary(user.location)
            )
コード例 #7
0
def randr_summary_task():
    """
        on 17th day of month or before if it's not a business day @ 3pm Tanzania time
    """

    now = datetime.utcnow()
    business_day = get_business_day_of_month_before(month=now.month, year=now.year, day=17)
    if now.day != business_day.day:
        return

    for domain in ILSGatewayConfig.get_all_enabled_domains():
        for user in get_district_people(domain):
            send_translated_message(
                user, REMINDER_MONTHLY_RANDR_SUMMARY, **construct_randr_summary(user.location)
            )
コード例 #8
0
ファイル: tasks.py プロジェクト: yonglehou/commcare-hq
def randr_summary_task():
    """
        on 17th day of month or before if it's not a business day @ 3pm Tanzania time
    """

    now = datetime.utcnow()
    business_day = get_business_day_of_month_before(month=now.month, year=now.year, day=17)
    if now.day != business_day.day:
        return

    for domain in ILSGatewayConfig.get_all_enabled_domains():
        for user in get_district_people(domain):
            send_translated_message(
                user, REMINDER_MONTHLY_RANDR_SUMMARY, **construct_randr_summary(user.location)
            )
コード例 #9
0
ファイル: api.py プロジェクト: sheelio/commcare-hq
 def _get_logistics_domains(self):
     from custom.ewsghana.models import EWSGhanaConfig
     return ILSGatewayConfig.get_all_enabled_domains() + EWSGhanaConfig.get_all_enabled_domains()
コード例 #10
0
def send_for_all_domains(date, reminder_class, **kwargs):
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        reminder_class(domain=domain, date=date, **kwargs).send()
コード例 #11
0
ファイル: utils.py プロジェクト: kamilk161/commcare-hq
def send_for_all_domains(date, fn, **kwargs):
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        fn(domain, date, **kwargs)
コード例 #12
0
def test_domains_report_run_periodic_task():
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        if domain == 'ils-gateway':
            # skip live domain
            continue
        report_run(domain)
コード例 #13
0
def send_for_all_domains(date, fn, **kwargs):
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        fn(domain, date, **kwargs)
コード例 #14
0
ファイル: api.py プロジェクト: ekush/commcare-hq
 def _get_logistics_domains(self):
     from custom.ewsghana.models import EWSGhanaConfig
     return ILSGatewayConfig.get_all_enabled_domains(
     ) + EWSGhanaConfig.get_all_enabled_domains()
コード例 #15
0
def test_domains_report_run_periodic_task():
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        if domain == 'ils-gateway':
            # skip live domain
            continue
        report_run(domain)
コード例 #16
0
ファイル: utils.py プロジェクト: nnestle/commcare-hq
def send_for_all_domains(date, reminder_class, **kwargs):
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        reminder_class(domain=domain, date=date, **kwargs).send()
コード例 #17
0
ファイル: api.py プロジェクト: LifeCoaching/commcare-hq
 def _get_logistics_domains(self):
     return ILSGatewayConfig.get_all_enabled_domains() + EWSGhanaConfig.get_all_enabled_domains()