コード例 #1
0
 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))
コード例 #2
0
 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))
コード例 #3
0
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
コード例 #4
0
ファイル: forms.py プロジェクト: dimagi/commcare-hq
    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))
コード例 #5
0
ファイル: forms.py プロジェクト: marissahrrsn/commcare-hq
    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))
コード例 #6
0
ファイル: test_analytics.py プロジェクト: ye-man/commcare-hq
 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)})
コード例 #7
0
 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)})