本文整理汇总了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)
示例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)
示例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])
示例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)
示例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])
示例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])
示例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])
示例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])
示例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)
示例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()
示例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()
示例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)
示例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()
示例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()
示例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()