Example #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))
Example #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()
Example #3
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))
Example #4
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()
Example #5
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)
            )
Example #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)
            )
Example #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)
            )
Example #8
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)
            )
Example #9
0
 def _get_logistics_domains(self):
     from custom.ewsghana.models import EWSGhanaConfig
     return ILSGatewayConfig.get_all_enabled_domains() + EWSGhanaConfig.get_all_enabled_domains()
Example #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()
Example #11
0
def send_for_all_domains(date, fn, **kwargs):
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        fn(domain, date, **kwargs)
Example #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)
Example #13
0
def send_for_all_domains(date, fn, **kwargs):
    for domain in ILSGatewayConfig.get_all_enabled_domains():
        fn(domain, date, **kwargs)
Example #14
0
 def _get_logistics_domains(self):
     from custom.ewsghana.models import EWSGhanaConfig
     return ILSGatewayConfig.get_all_enabled_domains(
     ) + EWSGhanaConfig.get_all_enabled_domains()
Example #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)
Example #16
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()
Example #17
0
 def _get_logistics_domains(self):
     return ILSGatewayConfig.get_all_enabled_domains() + EWSGhanaConfig.get_all_enabled_domains()