def _get_couchdb_counts(domain): couch_db_counts = Counter() for provider in DOC_PROVIDERS: if isinstance(provider, DocTypeIDProvider): for doc_type in provider.doc_types: if doc_type == 'CommCareUser': continue # want to split deleted doc_class = get_document_class_by_doc_type(doc_type) count = get_doc_count_in_domain_by_class(domain, doc_class) couch_db_counts.update({doc_type: count}) for row in CommCareMultimedia.get_db().view('hqmedia/by_domain', key=domain, include_docs=False): couch_db_counts.update(['CommCareMultimedia']) mobile_user_count = get_mobile_user_count(domain) couch_db_counts.update({ 'WebUser': get_web_user_count(domain), 'CommCareUser': mobile_user_count, 'CommCareUser-Deleted': get_doc_count_in_domain_by_class(domain, CommCareUser) - mobile_user_count }) # this is very slow, excluding for now # for _, doc_ids in SyncLogIDProvider().get_doc_ids(domain): # couch_db_counts['SyncLog'] += len(doc_ids) # return couch_db_counts
def _get_couchdb_counts(domain): couch_db_counts = Counter() for provider in DOC_PROVIDERS: if isinstance(provider, DocTypeIDProvider): for doc_type in provider.doc_types: if doc_type == 'CommCareUser': continue # want to split deleted doc_class = get_document_class_by_doc_type(doc_type) count = get_doc_count_in_domain_by_class(domain, doc_class) couch_db_counts.update({doc_type: count}) for row in CommCareMultimedia.get_db().view('hqmedia/by_domain', key=domain, include_docs=False): couch_db_counts.update(['CommCareMultimedia']) mobile_user_count = get_mobile_user_count(domain) couch_db_counts.update({ 'WebUser': get_web_user_count(domain), 'CommCareUser': mobile_user_count, 'CommCareUser-Deleted': get_doc_count_in_domain_by_class(domain, CommCareUser) - mobile_user_count }) # this is very slow, excluding for now # for _, doc_ids in SyncLogIDProvider().get_doc_ids(domain): # couch_db_counts['SyncLog'] += len(doc_ids) # return couch_db_counts
def _get_couchdb_counts(domain): couch_db_counts = Counter() for provider in DOC_PROVIDERS: if isinstance(provider, DocTypeIDProvider): doc_type = provider.doc_type if doc_type == 'CommCareUser': continue # want to split deleted doc_class = get_document_class_by_doc_type(doc_type) count = get_doc_count_in_domain_by_class(domain, doc_class) couch_db_counts.update({doc_type: count}) for _ in CommCareMultimedia.get_db().view('hqmedia/by_domain', key=domain, include_docs=False): couch_db_counts.update(['CommCareMultimedia']) mobile_user_count = get_mobile_user_count(domain) couch_db_counts.update({ 'WebUser': get_web_user_count(domain), 'CommCareUser': mobile_user_count, 'CommCareUser-Deleted': get_doc_count_in_domain_by_class(domain, CommCareUser) - mobile_user_count }) return couch_db_counts
def rows_for_domain(self, domain_obj): return [[ self.format_date(domain_obj.date_created), len(domain_obj.applications()), get_mobile_user_count(domain_obj.name, include_inactive=False), get_web_user_count(domain_obj.name, include_inactive=False), self.format_date(get_last_form_submission_received(domain_obj.name)), ] + self.domain_properties(domain_obj)]
def rows_for_domain(self, domain): return [[ self.format_date(domain.date_created), len(domain.applications()), get_mobile_user_count(domain.name, include_inactive=False), get_web_user_count(domain.name, include_inactive=False), self.format_date(get_last_form_submission_received(domain.name)), ] + self.domain_properties(domain)]
def _get_primary_db_counts(domain): db_counts = Counter() db_counts.update(get_primary_db_form_counts(domain)) db_counts.update(get_primary_db_case_counts(domain)) mobile_user_count = get_mobile_user_count(domain) db_counts.update({ 'WebUser': get_web_user_count(domain), 'CommCareUser': mobile_user_count, 'CommCareUser-Deleted': get_doc_count_in_domain_by_class(domain, CommCareUser) - mobile_user_count }) return db_counts
def rows_for_domain(self, domain): subscription = Subscription.get_active_subscription_by_domain( domain.name) plan_version = subscription.plan_version if subscription else DefaultProductPlan.get_default_plan_version( ) return [[ plan_version.plan.name, self.format_date(domain.date_created), get_mobile_user_count(domain.name, include_inactive=False), get_web_user_count(domain.name, include_inactive=False), self.format_date(get_last_form_submission_received(domain.name)), ] + self.domain_properties(domain)]
def _domain_rows(self, domain): subscription = Subscription.get_active_subscription_by_domain( domain.name) plan_version = subscription.plan_version if subscription else DefaultProductPlan.get_default_plan_version( ) return [ self._domain_properties(domain) + [ plan_version.plan.name, str(get_mobile_user_count(domain.name, include_inactive=False)), str(get_web_user_count(domain.name, include_inactive=False)), ] ]
def _get_primary_db_counts(domain): db_counts = Counter() db_counts.update(get_primary_db_form_counts(domain)) db_counts.update(get_primary_db_case_counts(domain)) mobile_user_count = get_mobile_user_count(domain) db_counts.update({ 'WebUser': get_web_user_count(domain), 'CommCareUser': mobile_user_count, 'CommCareUser-Deleted': get_doc_count_in_domain_by_class(domain, CommCareUser) - mobile_user_count }) return db_counts
def _get_couchdb_counts(domain): couch_db_counts = Counter() for provider in DOC_PROVIDERS: if isinstance(provider, DocTypeIDProvider): for doc_type in provider.doc_types: if doc_type == 'CommCareUser': continue # want to split deleted doc_class = get_document_class_by_doc_type(doc_type) count = get_doc_count_in_domain_by_class(domain, doc_class) couch_db_counts.update({doc_type: count}) mobile_user_count = get_mobile_user_count(domain) couch_db_counts.update({ 'WebUser': get_web_user_count(domain), 'CommCareUser': mobile_user_count, 'CommCareUser-Deleted': get_doc_count_in_domain_by_class(domain, CommCareUser) - mobile_user_count }) return couch_db_counts
def total_for_domain(self, domain_obj): return get_mobile_user_count(domain_obj.name, include_inactive=False)
def total_for_domain(self, domain_obj): return get_mobile_user_count(domain_obj.name, include_inactive=False)
def num_mobile_users(domain, *args): return get_mobile_user_count(domain, include_inactive=False)
def num_mobile_users(domain, *args): return get_mobile_user_count(domain, include_inactive=False)