当前位置: 首页>>代码示例>>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;未经允许,请勿转载。