當前位置: 首頁>>代碼示例>>Python>>正文


Python CommTrackUser.by_domain方法代碼示例

本文整理匯總了Python中corehq.apps.commtrack.models.CommTrackUser.by_domain方法的典型用法代碼示例。如果您正苦於以下問題:Python CommTrackUser.by_domain方法的具體用法?Python CommTrackUser.by_domain怎麽用?Python CommTrackUser.by_domain使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在corehq.apps.commtrack.models.CommTrackUser的用法示例。


在下文中一共展示了CommTrackUser.by_domain方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: send_soh_reminder

# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import by_domain [as 別名]
def send_soh_reminder(domain, date):
    sp_ids = set()
    for user in CommTrackUser.by_domain(domain):
        if user.is_active and user.location and user.location.location_type == 'FACILITY':
            sp = SupplyPointCase.get_by_location(user.location)
            if sp and not StockTransaction.objects.filter(case_id=sp._id, report__date__gte=date,
                                                          type='stockonhand').exists():
                if user.get_verified_number():
                        send_sms_to_verified_number(user.get_verified_number(), REMINDER_STOCKONHAND)
                        sp_ids.add(sp._id)
    update_statuses(sp_ids, SupplyPointStatusTypes.SOH_FACILITY, SupplyPointStatusValues.REMINDER_SENT)
開發者ID:dslowikowski,項目名稱:commcare-hq,代碼行數:13,代碼來源:stockonhand.py

示例2: send_supervision_reminder

# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import by_domain [as 別名]
def send_supervision_reminder(domain, date):
    sp_ids = set()
    for user in CommTrackUser.by_domain(domain):
        if user.is_active and user.location and user.location.location_type == 'FACILITY':
            sp = SupplyPointCase.get_by_location(user.location)
            if sp and not SupplyPointStatus.objects.filter(supply_point=sp._id,
                                                           status_type=SupplyPointStatusTypes.SUPERVISION_FACILITY,
                                                           status_date__gte=date).exists():
                if user.get_verified_number():
                        send_sms_to_verified_number(user.get_verified_number(), REMINDER_SUPERVISION)
                        sp_ids.add(sp._id)
    update_statuses(sp_ids, SupplyPointStatusTypes.SUPERVISION_FACILITY, SupplyPointStatusValues.REMINDER_SENT)
開發者ID:SEL-Columbia,項目名稱:commcare-hq,代碼行數:14,代碼來源:supervision.py

示例3: get_location_rows

# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import by_domain [as 別名]
def get_location_rows(domain):
    users = CommTrackUser.by_domain(domain)

    mappings = []
    for user in users:
        locations = user.locations
        for location in locations:
            mappings.append([
                user.raw_username,
                location.site_code,
                location.name
            ])

    return mappings
開發者ID:NoahCarnahan,項目名稱:commcare-hq,代碼行數:16,代碼來源:bulkupload.py

示例4: send_ror_reminder

# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import by_domain [as 別名]
def send_ror_reminder(domain, date, loc_type='FACILITY'):
    if loc_type == 'FACILITY':
        status_type = SupplyPointStatusTypes.R_AND_R_FACILITY
        sms_text = REMINDER_R_AND_R_FACILITY
    elif loc_type == 'DISTRICT':
        status_type = SupplyPointStatusTypes.R_AND_R_DISTRICT
        sms_text = REMINDER_R_AND_R_DISTRICT
    else:
        return
    current_group = DeliveryGroups().current_submitting_group(date.month)
    sp_ids = set()
    for user in CommTrackUser.by_domain(domain):
        if user.is_active and user.location and user.location.location_type == loc_type:
            sp = SupplyPointCase.get_by_location(user.location)
            if current_group in get_groups(sp.location.metadata.get('groups', None)) \
                    and not SupplyPointStatus.objects.filter(supply_point=sp._id, status_type=status_type,
                                                             status_date__gte=date).exists():
                if user.get_verified_number():
                    send_sms_to_verified_number(user.get_verified_number(), sms_text)
                    sp_ids.add(sp._id)
    update_statuses(sp_ids, status_type, SupplyPointStatusValues.REMINDER_SENT)
開發者ID:dslowikowski,項目名稱:commcare-hq,代碼行數:23,代碼來源:randr.py

示例5: _send_delivery_alert_to_facilities

# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import by_domain [as 別名]
 def _send_delivery_alert_to_facilities(self, sp_name, location):
     locs = [c._id for c in location.children]
     users = filter(lambda u: u.domain_membership["location_id"] in locs, CommTrackUser.by_domain(self.domain))
     for user in users:
         if user.get_verified_number():
             send_sms_to_verified_number(user.get_verified_number(), DELIVERY_CONFIRM_CHILDREN % {"district_name": sp_name})
開發者ID:SEL-Columbia,項目名稱:commcare-hq,代碼行數:8,代碼來源:delivered.py

示例6: _send_submission_alert_to_msd

# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import by_domain [as 別名]
 def _send_submission_alert_to_msd(self, params):
     users = filter(lambda u: u.user_data.get('role', None) == 'MSD', CommTrackUser.by_domain(self.domain))
     for user in users:
         if user.get_verified_number():
             send_sms_to_verified_number(user.get_verified_number(), SUBMITTED_NOTIFICATION_MSD % params)
開發者ID:dslowikowski,項目名稱:commcare-hq,代碼行數:7,代碼來源:randr.py

示例7: send_message

# 需要導入模塊: from corehq.apps.commtrack.models import CommTrackUser [as 別名]
# 或者: from corehq.apps.commtrack.models.CommTrackUser import by_domain [as 別名]
 def send_message(self, location, message, **kwargs):
     for user in CommTrackUser.by_domain(self.domain):
         dm = user.get_domain_membership(self.domain)
         if dm.location_id == location._id and user.get_verified_number():
             send_sms_to_verified_number(user.get_verified_number(), message % kwargs)
開發者ID:SEL-Columbia,項目名稱:commcare-hq,代碼行數:7,代碼來源:messageinitiator.py


注:本文中的corehq.apps.commtrack.models.CommTrackUser.by_domain方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。