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


Python StaticReportConfiguration.all方法代碼示例

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


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

示例1: test_for_report_id_conflicts

# 需要導入模塊: from corehq.apps.userreports.models import StaticReportConfiguration [as 別名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 別名]
 def test_for_report_id_conflicts(self):
     counts = Counter(rc.get_id for rc in
                      StaticReportConfiguration.all())
     duplicates = [k for k, v in counts.items() if v > 1]
     msg = "The following report configs have duplicate generated report_ids:\n{}".format(
         "\n".join("report_id: {}".format(report_id) for report_id in duplicates)
     )
     self.assertEqual(0, len(duplicates), msg)
開發者ID:dimagi,項目名稱:commcare-hq,代碼行數:10,代碼來源:test_static_reports.py

示例2: test_get_all

# 需要導入模塊: from corehq.apps.userreports.models import StaticReportConfiguration [as 別名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 別名]
 def test_get_all(self):
     with override_settings(STATIC_UCR_REPORTS=[self.get_path('static_report_config', 'json')]):
         all = list(StaticReportConfiguration.all())
         self.assertEqual(2, len(all))
         example, dimagi = all
         self.assertEqual('example', example.domain)
         self.assertEqual('dimagi', dimagi.domain)
         for config in all:
             self.assertEqual('Custom Title', config.title)
開發者ID:ansarbek,項目名稱:commcare-hq,代碼行數:11,代碼來源:test_static_reports.py

示例3: test_data_sources_actually_exist

# 需要導入模塊: from corehq.apps.userreports.models import StaticReportConfiguration [as 別名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 別名]
    def test_data_sources_actually_exist(self):

        data_sources_on_domain = defaultdict(set)
        for data_source in StaticDataSourceConfiguration.all():
            data_sources_on_domain[data_source.domain].add(data_source.get_id)

        def has_no_data_source(report_config):
            available_data_sources = data_sources_on_domain[report_config.domain]
            return report_config.config_id not in available_data_sources

        all_configs = StaticReportConfiguration.all()
        configs_missing_data_source = list(filter(has_no_data_source, all_configs))

        msg = ("There are {} report configs which reference data sources that "
               "don't exist (or which don't exist on that domain):\n{}".format(
                   len(configs_missing_data_source),
                   "\n".join(config.get_id for config in configs_missing_data_source)))
        self.assertEqual(0, len(configs_missing_data_source), msg)
開發者ID:dimagi,項目名稱:commcare-hq,代碼行數:20,代碼來源:test_static_reports.py

示例4: handle

# 需要導入模塊: from corehq.apps.userreports.models import StaticReportConfiguration [as 別名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 別名]
    def handle(self, **options):
        config_ids = get_doc_ids_by_class(ReportConfiguration)

        builder_count, ucr_count = 0, 0
        for doc in iter_docs(ReportConfiguration.get_db(), config_ids):
            if doc['report_meta']['created_by_builder']:
                builder_count += 1
            else:
                ucr_count += 1

        static_count = len(list(StaticReportConfiguration.all()))
        total_count = builder_count + ucr_count + static_count

        print(textwrap.dedent("""
            As of {}, on {} there are {} total UCRs:
            {} Report Builder Reports
            {} UCR Report Configs
            {} Static Report Configs enabled for the environment
        """.format(datetime.utcnow().date(), settings.SERVER_ENVIRONMENT, total_count,
                   builder_count, ucr_count, static_count)))
開發者ID:dimagi,項目名稱:commcare-hq,代碼行數:22,代碼來源:count_ucrs.py

示例5: test_production_config

# 需要導入模塊: from corehq.apps.userreports.models import StaticReportConfiguration [as 別名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 別名]
 def test_production_config(self):
     for data_source in StaticReportConfiguration.all():
         data_source.validate()
開發者ID:saketkanth,項目名稱:commcare-hq,代碼行數:5,代碼來源:test_static_reports.py

示例6: test_production_config

# 需要導入模塊: from corehq.apps.userreports.models import StaticReportConfiguration [as 別名]
# 或者: from corehq.apps.userreports.models.StaticReportConfiguration import all [as 別名]
 def test_production_config(self):
     for report_config in StaticReportConfiguration.all():
         report_config.validate()
開發者ID:dimagi,項目名稱:commcare-hq,代碼行數:5,代碼來源:test_static_reports.py


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