def _all_forms(self): """ Here we grab all forms ever submitted to this domain on CommCare HQ or all forms that the Applications for this domain know about. """ form_buckets = get_all_xmlns_app_id_pairs_submitted_to_in_domain(self.domain) all_submitted = {self.make_xmlns_app_key(xmlns, app_id) for xmlns, app_id in form_buckets} from_apps = set(self._application_forms) return list(all_submitted.union(from_apps))
def _all_forms(self): """ Here we grab all forms ever submitted to this domain on CommCare HQ or all forms that the Applications for this domain know about. """ form_buckets = get_all_xmlns_app_id_pairs_submitted_to_in_domain(self.domain) all_submitted = {self.make_xmlns_app_key(xmlns, app_id) for xmlns, app_id in form_buckets} from_apps = set(self._application_forms) return list(all_submitted.union(from_apps))
def _get_form_size_stats(domain, sample_size): total_bytes = 0 total_forms = 0 for xmlns, app_id in get_all_xmlns_app_id_pairs_submitted_to_in_domain( domain): query = (FormES().domain(domain).sort( 'received_on', desc=True).app(app_id).xmlns(xmlns).size(sample_size)) num_forms, avg_size = _get_totals_for_query(query) total_bytes += num_forms * avg_size total_forms += num_forms return total_forms, total_bytes
def _all_forms(self): """ Here we grab all forms ever submitted to this domain on CommCare HQ or all forms that the Applications for this domain know about. This fails after a couple hundred million forms are submitted to the domain. After that happens we'll just display a warning """ try: form_buckets = get_all_xmlns_app_id_pairs_submitted_to_in_domain(self.domain) except ESError: self._all_form_retrieval_failed = True form_buckets = [] all_submitted = {self.make_xmlns_app_key(xmlns, app_id) for xmlns, app_id in form_buckets} from_apps = set(self._application_forms) return list(all_submitted.union(from_apps))
def _all_forms(self): """ Here we grab all forms ever submitted to this domain on CommCare HQ or all forms that the Applications for this domain know about. This fails after a couple hundred million forms are submitted to the domain. After that happens we'll just display a warning """ try: form_buckets = get_all_xmlns_app_id_pairs_submitted_to_in_domain(self.domain) except ESError: self._all_form_retrieval_failed = True form_buckets = [] all_submitted = {self.make_xmlns_app_key(xmlns, app_id) for xmlns, app_id in form_buckets} from_apps = set(self._application_forms) return list(all_submitted.union(from_apps))
def test_get_all_xmlns_app_id_pairs_submitted_to_in_domain(self): self.assertEqual( get_all_xmlns_app_id_pairs_submitted_to_in_domain(self.domain), {(self.xmlns, self.app_id)})
def test_get_all_xmlns_app_id_pairs_submitted_to_in_domain(self): self.assertEqual(get_all_xmlns_app_id_pairs_submitted_to_in_domain(self.domain), {(self.xmlns, self.app_id)})