def test_district_exclusion(self):
        self.user1.location_id = self.facility.get_id
        self.user1.save()
        people = list(get_district_people(TEST_DOMAIN))
        self.assertEqual(len(people), 0)

        self.user1.location_id = self.district.get_id
        self.user1.save()
        people = list(get_district_people(TEST_DOMAIN))
        self.assertEqual(len(people), 1)
    def test_district_exclusion(self):
        self.user1.location_id = self.facility.get_id
        self.user1.save()
        people = list(get_district_people(TEST_DOMAIN))
        self.assertEqual(len(people), 0)

        self.user1.location_id = self.district.get_id
        self.user1.save()
        people = list(get_district_people(TEST_DOMAIN))
        self.assertEqual(len(people), 1)
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_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 #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)
            )
 def test_basic_list(self):
     people = list(get_district_people(TEST_DOMAIN))
     self.assertEqual(len(people), 1)
     self.assertEqual(people[0].get_id, self.user1.get_id)
 def test_basic_list(self):
     people = list(get_district_people(TEST_DOMAIN))
     self.assertEqual(len(people), 1)
     self.assertEqual(people[0].get_id, self.user1.get_id)