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


Python EWSGhanaConfig.get_all_enabled_domains方法代码示例

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


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

示例1: second_soh_reminder

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def second_soh_reminder():
    now = datetime.datetime.utcnow()
    date = now - datetime.timedelta(days=DAYS_UNTIL_LATE)
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            second_soh_process_user(user, date)
开发者ID:jmaina,项目名称:commcare-hq,代码行数:9,代码来源:reminders.py

示例2: first_soh_reminder

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def first_soh_reminder():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            role = user.user_data.get('role')
            if role and role != IN_CHARGE_ROLE:
                first_soh_process_user(user)
开发者ID:LifeCoaching,项目名称:commcare-hq,代码行数:9,代码来源:reminders.py

示例3: on_going_non_reporting

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def on_going_non_reporting():
    now = datetime.datetime.utcnow()
    date = now - datetime.timedelta(days=21)
    domains = EWSGhanaConfig.get_all_enabled_domains()

    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            try:
                user_location = SQLLocation.objects.get(domain=domain, location_id=user.location._id)
            except AttributeError:
                continue
            if user_location:
                facilities = []
                if user_location.location_type == 'district':
                    facilities = user_location.get_children()
                elif user_location.location_type == 'region':
                    facilities = SQLLocation.objects.filter(domain=domain,
                                                            parent__parent__location_id=user.location._id)
                fac = set()
                for facility in facilities:
                    sp = facility.supply_point_id
                    if sp and not StockTransaction.objects.filter(
                            case_id=sp, type="stockonhand", report__date__gte=date).exists():
                        fac.add(str(facility.name))
                if fac and user.get_verified_number():
                    message = ONGOING_NON_REPORTING % " \n".join(fac)
                    send_sms_to_verified_number(user.get_verified_number(), message)
                    if user.email:
                        email = str(user.email)
                        send_mail('ONGOING NON REPORTING', message, '[email protected]', [email])
开发者ID:jmaina,项目名称:commcare-hq,代码行数:32,代码来源:alerts.py

示例4: second_soh_reminder

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def second_soh_reminder():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            roles = user.user_data.get('role')
            if roles and IN_CHARGE_ROLE in roles:
                second_soh_process_user(user)
开发者ID:sheelio,项目名称:commcare-hq,代码行数:9,代码来源:reminders.py

示例5: reminder_to_visit_website

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def reminder_to_visit_website():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            if user.location and user.last_login < datetime.datetime.now() - datetime.timedelta(weeks=13) and\
                    user.get_verified_number() and \
                    (user.location.location_type == 'district' or user.location.location_type == 'region'
                     or user.location.location_type == 'country'):
                    message = WEB_REMINDER % user.name
                    send_sms_to_verified_number(user.get_verified_number(), message)
                    if user.email:
                        email = str(user.email)
                        send_mail('REMINDER TO VISIT WEBSITE', message, '[email protected]', [email])
开发者ID:jmaina,项目名称:commcare-hq,代码行数:15,代码来源:alerts.py

示例6: reminder_to_visit_website

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def reminder_to_visit_website():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            thirteen_days_ago = datetime.datetime.utcnow() - datetime.timedelta(weeks=13)
            if user.location and user.last_login < thirteen_days_ago and user.get_verified_number()\
                    and user.location.location_type.name in ['district', 'region', 'country']:
                    message = WEB_REMINDER % user.name
                    verified_number = user.get_verified_number()
                    send_sms_to_verified_number(verified_number, message)
                    if can_receive_email(user, verified_number):
                        email = str(user.email)
                        send_mail('REMINDER TO VISIT WEBSITE', message, '[email protected]', [email])
开发者ID:LifeCoaching,项目名称:commcare-hq,代码行数:15,代码来源:alerts.py

示例7: report_reminder

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def report_reminder():
    sp_ids = set()
    now = datetime.datetime.utcnow()
    date = now - datetime.timedelta(days=7)
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            if user.location:
                sp = SupplyPointCase.get_by_location(user.location)
                if sp and not StockTransaction.objects.filter(
                    case_id=sp._id, type="stockonhand", report__date__gte=date).exists()\
                        and user.get_verified_number():
                    sp_ids.add(sp._id)
                    message = REPORT_REMINDER % (user.name, user.location.name)
                    send_sms_to_verified_number(user.get_verified_number(), message)
                    if user.email:
                        email = str(user.email)
                        send_mail('REPORT REMINDER', message, '[email protected]', [email])
开发者ID:jmaina,项目名称:commcare-hq,代码行数:20,代码来源:alerts.py

示例8: urgent_stockout

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def urgent_stockout():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        for user in CommCareUser.by_domain(domain):
            try:
                user_location = SQLLocation.objects.get(domain=domain, location_id=user.location._id)
            except AttributeError:
                continue
            if user_location:
                facilities = []
                if user_location.location_type == 'district':
                    facilities = user_location.get_children()
                elif user_location.location_type == 'region':
                    facilities = SQLLocation.objects.filter(domain=domain,
                                                            parent__parent__location_id=user.location._id)
                elif user_location.location_type == 'country':
                    facilities = SQLLocation.objects.filter(domain=domain,
                                                            parent__parent__parent__location_id=user.location._id)
                stocked_out_products = set()
                fac = set()
                no_rep = 0
                for facility in facilities:
                    sp = facility.supply_point_id
                    if sp:
                        stocked_out = StockTransaction.objects.filter(
                            case_id=sp, type="stockonhand", stock_on_hand=0)
                        if stocked_out.exists():
                            no_rep += 1
                            fac.add(str(facility))
                            for product in stocked_out:
                                stocked_out_products.add(
                                    SQLProduct.objects.get(product_id=product.product_id).name)

                if fac and no_rep >= len(facilities) / 2 and user.get_verified_number():
                    message = URGENT_STOCKOUT % (user_location.name, ", ".join(sorted(
                        [str(product) for product in stocked_out_products])))
                    send_sms_to_verified_number(user.get_verified_number(), message)
                    if user.email:
                        email = str(user.email)
                        send_mail('URGENT STOCKOUT', message, '[email protected]', [email])
开发者ID:jmaina,项目名称:commcare-hq,代码行数:42,代码来源:alerts.py

示例9: urgent_stockout

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def urgent_stockout():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        UrgentStockoutAlert(domain)
开发者ID:johan--,项目名称:commcare-hq,代码行数:6,代码来源:tasks.py

示例10: first_soh_reminder

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def first_soh_reminder():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        FirstSOHReminder(domain).send()
开发者ID:johan--,项目名称:commcare-hq,代码行数:6,代码来源:tasks.py

示例11: on_going_stockout

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def on_going_stockout():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        OnGoingStockouts(domain).send()
        OnGoingStockoutsRMS(domain).send()
开发者ID:johan--,项目名称:commcare-hq,代码行数:7,代码来源:tasks.py

示例12: urgent_non_reporting

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def urgent_non_reporting():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        UrgentNonReporting(domain)
开发者ID:johan--,项目名称:commcare-hq,代码行数:6,代码来源:tasks.py

示例13: reminder_to_visit_website

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def reminder_to_visit_website():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        VisitWebsiteReminder(domain).send()
开发者ID:johan--,项目名称:commcare-hq,代码行数:6,代码来源:tasks.py

示例14: on_going_non_reporting

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def on_going_non_reporting():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        OnGoingNonReporting(domain).send()
开发者ID:johan--,项目名称:commcare-hq,代码行数:6,代码来源:tasks.py

示例15: stockout_notification_to_web_supers

# 需要导入模块: from custom.ewsghana.models import EWSGhanaConfig [as 别名]
# 或者: from custom.ewsghana.models.EWSGhanaConfig import get_all_enabled_domains [as 别名]
def stockout_notification_to_web_supers():
    domains = EWSGhanaConfig.get_all_enabled_domains()
    for domain in domains:
        StockoutReminder(domain).send()
开发者ID:johan--,项目名称:commcare-hq,代码行数:6,代码来源:tasks.py


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