Ejemplo n.º 1
0
    def test_get_by_domain(self):
        results = ReportConfiguration.by_domain('foo')
        self.assertEqual(2, len(results))
        for item in results:
            self.assertTrue(item.config_id in ('foo1', 'foo2'))

        results = ReportConfiguration.by_domain('not-foo')
        self.assertEqual(0, len(results))
Ejemplo n.º 2
0
    def testGetByDomain(self):
        results = ReportConfiguration.by_domain('foo')
        self.assertEqual(2, len(results))
        for item in results:
            self.assertTrue(item.config_id in ('foo1', 'foo2'))

        results = ReportConfiguration.by_domain('not-foo')
        self.assertEqual(0, len(results))
Ejemplo n.º 3
0
    def test_get_by_domain(self):
        results = ReportConfiguration.by_domain("foo")
        self.assertEqual(2, len(results))
        for item in results:
            self.assertTrue(item.config_id in ("foo1", "foo2"))

        results = ReportConfiguration.by_domain("not-foo")
        self.assertEqual(0, len(results))
Ejemplo n.º 4
0
    def test_linking_second_report_creates_single_datasource(self):
        create_linked_ucr(self.domain_link, self.report.get_id)

        new_report = get_sample_report_config()
        new_report.title = "Another Report"
        new_report.config_id = self.data_source.get_id
        new_report.domain = self.domain
        new_report.save()

        create_linked_ucr(self.domain_link, new_report.get_id)
        self.assertEqual(2, len(ReportConfiguration.by_domain(self.domain_link.linked_domain)))
        self.assertItemsEqual(
            [self.report.title, new_report.title],
            [r.title for r in ReportConfiguration.by_domain(self.domain_link.linked_domain)],
        )
Ejemplo n.º 5
0
def get_existing_reports(domain):
    from corehq.apps.userreports.models import ReportConfiguration
    existing_reports = ReportConfiguration.by_domain(domain)
    return [
        report for report in existing_reports
        if not (report.title and report.title.startswith(TEMP_REPORT_PREFIX))
    ]
Ejemplo n.º 6
0
def _get_configurable_reports(project):
    """
    User configurable reports
    """
    configs = ReportConfiguration.by_domain(
        project.name) + CustomReportConfiguration.by_domain(project.name)
    if configs:

        def _make_report_class(config):
            from corehq.apps.reports.generic import GenericReportView

            # this is really annoying.
            # the report metadata should really be pulled outside of the report classes
            @classmethod
            def get_url(cls, domain, **kwargs):
                return reverse(ConfigurableReport.slug,
                               args=[domain, config._id])

            @classmethod
            def show_in_navigation(cls, domain=None, project=None, user=None):
                return config.visible or (
                    user and toggles.USER_CONFIGURABLE_REPORTS.enabled(
                        user.username))

            return type(
                'DynamicReport{}'.format(config._id), (GenericReportView, ), {
                    'name': config.title,
                    'description': config.description or None,
                    'get_url': get_url,
                    'show_in_navigation': show_in_navigation,
                })

        yield (_('Reports'),
               [_make_report_class(config) for config in configs])
Ejemplo n.º 7
0
def _shared_context(domain):
    custom_data_sources = list(CustomDataSourceConfiguration.by_domain(domain))
    return {
        'domain': domain,
        'reports': ReportConfiguration.by_domain(domain),
        'data_sources': DataSourceConfiguration.by_domain(domain) + custom_data_sources,
    }
Ejemplo n.º 8
0
    def test_remote_link_ucr(self, fake_ucr_getter):
        create_domain(self.domain)
        self.addCleanup(delete_all_domains)

        couch_user = WebUser.create(self.domain, "test", "foobar", None, None)
        django_user = couch_user.get_django_user()
        self.addCleanup(delete_all_users)

        api_key, _ = HQApiKey.objects.get_or_create(user=django_user)
        auth_headers = {'HTTP_AUTHORIZATION': 'apikey test:%s' % api_key.key}
        self.domain_link.save()

        url = reverse('linked_domain:ucr_config', args=[self.domain, self.report.get_id])
        headers = auth_headers.copy()
        headers[REMOTE_REQUESTER_HEADER] = self.domain_link.linked_domain
        resp = self.client.get(url, **headers)

        fake_ucr_getter.return_value = json.loads(resp.content)

        # Create
        linked_report_info = create_linked_ucr(self.domain_link, self.report.get_id)
        self.assertEqual(1, len(ReportConfiguration.by_domain(self.domain_link.linked_domain)))
        self.assertEqual(self.report.get_id, linked_report_info.report.report_meta.master_id)

        # Update
        self.report.title = "Another new title"
        self.report.save()

        update_linked_ucr(self.domain_link, linked_report_info.report.get_id)
        report = ReportConfiguration.get(linked_report_info.report.get_id)
        self.assertEqual("Another new title", report.title)
Ejemplo n.º 9
0
def _get_report_module_context(app, module):
    def _report_to_config(report):
        return {
            'report_id': report._id,
            'title': report.title,
            'description': report.description,
            'charts': [chart for chart in report.charts if
                       chart.type == 'multibar'],
            'filter_structure': report.filters_without_prefilters,
        }

    all_reports = ReportConfiguration.by_domain(app.domain) + \
                  StaticReportConfiguration.by_domain(app.domain)
    warnings = []
    validity = module.check_report_validity()

    # We're now proactively deleting these references, so after that's been
    # out for a while, this can be removed (say June 2016 or later)
    if not validity.is_valid:
        module.report_configs = validity.valid_report_configs
        warnings.append(
            gettext_lazy('Your app contains references to reports that are '
                         'deleted. These will be removed on save.')
        )

    return {
        'all_reports': [_report_to_config(r) for r in all_reports],
        'current_reports': [r.to_json() for r in module.report_configs],
        'warnings': warnings,
    }
Ejemplo n.º 10
0
def number_of_report_builder_reports(domain):
    from corehq.apps.userreports.models import ReportConfiguration
    existing_reports = ReportConfiguration.by_domain(domain)
    builder_reports = filter(
        lambda report: report.report_meta.created_by_builder, existing_reports
    )
    return len(builder_reports)
Ejemplo n.º 11
0
def _get_report_module_context(app, module):
    def _report_to_config(report):
        return {
            'report_id': report._id,
            'title': report.title,
            'description': report.description,
            'charts': [chart for chart in report.charts if
                       chart.type == 'multibar'],
            'filter_structure': report.filters,
        }

    all_reports = ReportConfiguration.by_domain(app.domain)
    warnings = []
    validity = module.check_report_validity()

    if not validity.is_valid:
        module.report_configs = validity.valid_report_configs
        warnings.append(
            gettext_lazy(
                'Your app contains references to reports that are deleted. These will be removed on save.')
        )
    return {
        'all_reports': [_report_to_config(r) for r in all_reports],
        'current_reports': [r.to_json() for r in module.report_configs],
        'warnings': warnings,
    }
Ejemplo n.º 12
0
def _get_report_module_context(app, module):
    def _report_to_config(report):
        return {
            'report_id': report._id,
            'title': report.title,
            'description': report.description,
            'charts': [chart for chart in report.charts if
                       chart.type == 'multibar'],
            'filter_structure': report.filters_without_prefilters,
        }

    all_reports = ReportConfiguration.by_domain(app.domain) + \
                  StaticReportConfiguration.by_domain(app.domain)
    validity = module.check_report_validity()

    # We're now proactively deleting these references, so after that's been
    # out for a while, this can be removed (say June 2016 or later)
    if not validity.is_valid:
        module.report_configs = validity.valid_report_configs

    filter_choices = [
        {'slug': f.doc_type, 'description': f.short_description} for f in get_all_mobile_filter_configs()
    ]
    auto_filter_choices = [
        {'slug': f.slug, 'description': f.short_description} for f in get_auto_filter_configurations()

    ]
    return {
        'all_reports': [_report_to_config(r) for r in all_reports],
        'current_reports': [r.to_json() for r in module.report_configs],
        'filter_choices': filter_choices,
        'auto_filter_choices': auto_filter_choices,
        'daterange_choices': [choice._asdict() for choice in get_simple_dateranges()],
    }
Ejemplo n.º 13
0
def _get_report_module_context(app, module):
    def _report_to_config(report):
        return {
            'report_id': report._id,
            'title': report.title,
            'description': report.description,
            'charts': [chart for chart in report.charts if
                       chart.type == 'multibar'],
            'filter_structure': report.filters,
        }

    all_reports = ReportConfiguration.by_domain(app.domain)
    all_report_ids = set([r._id for r in all_reports])
    invalid_report_references = filter(
        lambda r: r.report_id not in all_report_ids, module.report_configs)
    warnings = []
    if invalid_report_references:
        module.report_configs = filter(lambda r: r.report_id in all_report_ids,
                                       module.report_configs)
        warnings.append(
            gettext_lazy(
                'Your app contains references to reports that are deleted. These will be removed on save.')
        )
    return {
        'all_reports': [_report_to_config(r) for r in all_reports],
        'current_reports': [r.to_json() for r in module.report_configs],
        'invalid_report_references': invalid_report_references,
        'warnings': warnings,
    }
Ejemplo n.º 14
0
def _get_report_builder_reports(project):
    from corehq.apps.userreports.models import ReportConfiguration
    reports = ReportConfiguration.by_domain(project.name)
    return filter(
        lambda report: report.report_meta.created_by_builder,
        reports
    )
Ejemplo n.º 15
0
def _get_configurable_reports(project):
    """
    User configurable reports
    """
    configs = ReportConfiguration.by_domain(project.name)
    if configs:
        def _make_report_class(config):
            from corehq.apps.reports.generic import GenericReportView

            # this is really annoying.
            # the report metadata should really be pulled outside of the report classes
            @classmethod
            def get_url(cls, domain, **kwargs):
                return reverse(ConfigurableReport.slug, args=[domain, config._id])

            @classmethod
            def show_in_navigation(cls, domain=None, project=None, user=None):
                return config.visible or (user and toggles.USER_CONFIGURABLE_REPORTS.enabled(user.username))

            return type('DynamicReport{}'.format(config._id), (GenericReportView, ), {
                'name': config.title,
                'description': config.description or None,
                'get_url': get_url,
                'show_in_navigation': show_in_navigation,
            })

        yield (_('Project Reports'), [_make_report_class(config) for config in configs])
Ejemplo n.º 16
0
def _get_report_builder_reports(project):
    from corehq.apps.userreports.models import ReportConfiguration
    reports = ReportConfiguration.by_domain(project.name)
    return filter(
        lambda report: report.report_meta.created_by_builder,
        reports
    )
Ejemplo n.º 17
0
def _get_report_module_context(app, module):
    def _report_to_config(report):
        return {
            'report_id':
            report._id,
            'title':
            report.title,
            'description':
            report.description,
            'charts':
            [chart for chart in report.charts if chart.type == 'multibar'],
            'filter_structure':
            report.filters_without_prefilters,
        }

    all_reports = ReportConfiguration.by_domain(app.domain) + \
                  StaticReportConfiguration.by_domain(app.domain)
    warnings = []
    validity = module.check_report_validity()

    # We're now proactively deleting these references, so after that's been
    # out for a while, this can be removed (say June 2016 or later)
    if not validity.is_valid:
        module.report_configs = validity.valid_report_configs
        warnings.append(
            gettext_lazy('Your app contains references to reports that are '
                         'deleted. These will be removed on save.'))

    return {
        'all_reports': [_report_to_config(r) for r in all_reports],
        'current_reports': [r.to_json() for r in module.report_configs],
        'warnings': warnings,
    }
Ejemplo n.º 18
0
def number_of_report_builder_reports(domain):
    from corehq.apps.userreports.models import ReportConfiguration
    existing_reports = ReportConfiguration.by_domain(domain)
    builder_reports = [
        report for report in existing_reports
        if report.report_meta.created_by_builder
    ]
    return len(builder_reports)
Ejemplo n.º 19
0
 def ucr_displays_by_id(self):
     return {
         config._id: _link(
             config.title,
             reverse(ConfigurableReportView.slug,
                     args=[self.domain, config._id]))
         for config in ReportConfiguration.by_domain(self.domain)
     }
Ejemplo n.º 20
0
def _get_existing_reports(domain):
    from corehq.apps.userreports.models import ReportConfiguration
    from corehq.apps.userreports.views import TEMP_REPORT_PREFIX
    existing_reports = ReportConfiguration.by_domain(domain)
    return [
        report for report in existing_reports
        if not report.title.startswith(TEMP_REPORT_PREFIX)
    ]
Ejemplo n.º 21
0
def _shared_context(domain):
    static_reports = list(StaticReportConfiguration.by_domain(domain))
    static_data_sources = list(StaticDataSourceConfiguration.by_domain(domain))
    return {
        'domain': domain,
        'reports': ReportConfiguration.by_domain(domain) + static_reports,
        'data_sources': DataSourceConfiguration.by_domain(domain) + static_data_sources,
    }
Ejemplo n.º 22
0
 def main_context(self):
     static_reports = list(StaticReportConfiguration.by_domain(self.domain))
     static_data_sources = list(StaticDataSourceConfiguration.by_domain(self.domain))
     context = super(BaseUserConfigReportsView, self).main_context
     context.update({
         'reports': ReportConfiguration.by_domain(self.domain) + static_reports,
         'data_sources': DataSourceConfiguration.by_domain(self.domain) + static_data_sources,
     })
     return context
Ejemplo n.º 23
0
def _shared_context(domain):
    custom_data_sources = list(CustomDataSourceConfiguration.by_domain(domain))
    return {
        'domain':
        domain,
        'reports':
        ReportConfiguration.by_domain(domain),
        'data_sources':
        DataSourceConfiguration.by_domain(domain) + custom_data_sources,
    }
Ejemplo n.º 24
0
def number_of_report_builder_reports(domain):
    from corehq.apps.userreports.models import ReportConfiguration
    from corehq.apps.userreports.views import TEMP_REPORT_PREFIX
    existing_reports = ReportConfiguration.by_domain(domain)
    builder_reports = [
        report for report in existing_reports
        if report.report_meta.created_by_builder
        and not report.title.startswith(TEMP_REPORT_PREFIX)
    ]
    return len(builder_reports)
Ejemplo n.º 25
0
def _get_report_module_context(app, module):
    def _report_to_config(report):
        return {
            'report_id': report._id,
            'title': report.title,
            'description': report.description,
            'charts': [chart for chart in report.charts if
                       chart.type == 'multibar'],
            'filter_structure': report.filters_without_prefilters,
        }

    all_reports = ReportConfiguration.by_domain(app.domain) + \
                  StaticReportConfiguration.by_domain(app.domain)
    validity = module.check_report_validity()

    # We're now proactively deleting these references, so after that's been
    # out for a while, this can be removed (say June 2016 or later)
    if not validity.is_valid:
        module.report_configs = validity.valid_report_configs

    filter_choices = [
        {'slug': f.doc_type, 'description': f.short_description} for f in get_all_mobile_filter_configs()
    ]
    auto_filter_choices = [
        {'slug': f.slug, 'description': f.short_description} for f in get_auto_filter_configurations()

    ]
    from corehq.apps.app_manager.suite_xml.features.mobile_ucr import get_column_xpath_client_template, get_data_path
    data_path_placeholders = {}
    for r in module.report_configs:
        data_path_placeholders[r.report_id] = {}
        for chart_id in r.complete_graph_configs.keys():
            data_path_placeholders[r.report_id][chart_id] = get_data_path(r, app.domain)

    context = {
        'report_module_options': {
            'moduleName': module.name,
            'moduleFilter': module.module_filter,
            'availableReports': [_report_to_config(r) for r in all_reports],  # structure for all reports
            'currentReports': [r.to_json() for r in module.report_configs],  # config data for app reports
            'columnXpathTemplate': get_column_xpath_client_template(app.mobile_ucr_restore_version),
            'dataPathPlaceholders': data_path_placeholders,
            'languages': app.langs,
            'mobileUcrV1': app.mobile_ucr_restore_version == MOBILE_UCR_VERSION_1,
            'globalSyncDelay': Domain.get_by_name(app.domain).default_mobile_ucr_sync_interval,
        },
        'static_data_options': {
            'filterChoices': filter_choices,
            'autoFilterChoices': auto_filter_choices,
            'dateRangeOptions': [choice._asdict() for choice in get_simple_dateranges()],
        },
        'uuids_by_instance_id': get_uuids_by_instance_id(app.domain),
        'legacy_select2': True,
    }
    return context
Ejemplo n.º 26
0
def _shared_context(domain):
    static_reports = list(StaticReportConfiguration.by_domain(domain))
    static_data_sources = list(StaticDataSourceConfiguration.by_domain(domain))
    return {
        'domain':
        domain,
        'reports':
        ReportConfiguration.by_domain(domain) + static_reports,
        'data_sources':
        DataSourceConfiguration.by_domain(domain) + static_data_sources,
    }
Ejemplo n.º 27
0
def _new_report_module(request, domain, app, name, lang):
    module = app.add_module(ReportModule.new_module(name, lang))
    # by default add all reports
    module.report_configs = [
        ReportAppConfig(
            report_id=report._id,
            header={lang: report.title},
            description={lang: report.description},
        ) for report in ReportConfiguration.by_domain(domain)
    ]
    app.save()
    return back_to_main(request, domain, app_id=app.id, module_id=module.id)
Ejemplo n.º 28
0
def _get_report_module_context(app, module):
    def _report_to_config(report):
        return {
            'report_id': report._id,
            'title': report.title,
            'description': report.description,
            'charts': [chart for chart in report.charts if
                       chart.type == 'multibar'],
            'filter_structure': report.filters_without_prefilters,
        }

    all_reports = ReportConfiguration.by_domain(app.domain) + \
                  StaticReportConfiguration.by_domain(app.domain)
    validity = module.check_report_validity()

    # We're now proactively deleting these references, so after that's been
    # out for a while, this can be removed (say June 2016 or later)
    if not validity.is_valid:
        module.report_configs = validity.valid_report_configs

    filter_choices = [
        {'slug': f.doc_type, 'description': f.short_description} for f in get_all_mobile_filter_configs()
    ]
    auto_filter_choices = [
        {'slug': f.slug, 'description': f.short_description} for f in get_auto_filter_configurations()

    ]
    from corehq.apps.app_manager.suite_xml.features.mobile_ucr import get_column_xpath_client_template, get_data_path
    data_path_placeholders = {}
    for r in module.report_configs:
        data_path_placeholders[r.report_id] = {}
        for chart_id in r.complete_graph_configs.keys():
            data_path_placeholders[r.report_id][chart_id] = get_data_path(r, app.domain)

    context = {
        'report_module_options': {
            'moduleName': module.name,
            'moduleFilter': module.module_filter,
            'availableReports': [_report_to_config(r) for r in all_reports],  # structure for all reports
            'currentReports': [r.to_json() for r in module.report_configs],  # config data for app reports
            'columnXpathTemplate': get_column_xpath_client_template(app.mobile_ucr_restore_version),
            'dataPathPlaceholders': data_path_placeholders,
            'languages': app.langs,
            'supportSyncDelay': app.mobile_ucr_restore_version != MOBILE_UCR_VERSION_1,
            'globalSyncDelay': Domain.get_by_name(app.domain).default_mobile_ucr_sync_interval,
        },
        'static_data_options': {
            'filterChoices': filter_choices,
            'autoFilterChoices': auto_filter_choices,
            'dateRangeOptions': [choice._asdict() for choice in get_simple_dateranges()],
        },
    }
    return context
Ejemplo n.º 29
0
 def main_context(self):
     static_reports = list(StaticReportConfiguration.by_domain(self.domain))
     static_data_sources = list(
         StaticDataSourceConfiguration.by_domain(self.domain))
     context = super(BaseUserConfigReportsView, self).main_context
     context.update({
         'reports':
         ReportConfiguration.by_domain(self.domain) + static_reports,
         'data_sources':
         DataSourceConfiguration.by_domain(self.domain) +
         static_data_sources,
     })
     return context
Ejemplo n.º 30
0
def _new_report_module(request, domain, app, name, lang):
    module = app.add_module(ReportModule.new_module(name, lang))
    # by default add all reports
    module.report_configs = [
        ReportAppConfig(
            report_id=report._id,
            header={lang: report.title},
            description=report.description,
        )
        for report in ReportConfiguration.by_domain(domain)
    ]
    app.save()
    return back_to_main(request, domain, app_id=app.id, module_id=module.id)
Ejemplo n.º 31
0
 def response_report_builder(project, new_plan_version):
     from corehq.apps.userreports.models import ReportConfiguration
     from corehq.apps.userreports.tasks import rebuild_indicators
     reports = ReportConfiguration.by_domain(project.name)
     builder_reports = [report for report in reports if report.report_meta.created_by_builder]
     for report in builder_reports:
         try:
             report.visible = True
             report.save()
             if report.config.is_deactivated:
                 report.config.is_deactivated = False
                 report.config.save()
                 rebuild_indicators.delay(report.config._id)
         except DataSourceConfigurationNotFoundError:
             pass
     return True
Ejemplo n.º 32
0
    def clean(self):
        """
        Raise a validation error if there are already 5 data sources and this
        report won't be able to use one of the existing ones.
        """
        cleaned_data = super(DataSourceForm, self).clean()

        existing_reports = ReportConfiguration.by_domain(self.domain)
        builder_reports = filter(lambda report: report.report_meta.created_by_builder, existing_reports)
        if len(builder_reports) >= self.max_allowed_reports:
            raise forms.ValidationError(_(
                "Too many reports!\n"
                "Creating this report would cause you to go over the maximum "
                "number of report builder reports allowed in this domain. Your"
                "limit is {number}. "
                "To continue, delete another report and try again. "
            ).format(number=self.max_allowed_reports))

        return cleaned_data
Ejemplo n.º 33
0
def _safely_get_report_configs(project_name):
    try:
        configs = ReportConfiguration.by_domain(project_name)
    except BadSpecError as e:
        logging.exception(e)

        # Pick out the UCRs that don't have spec errors
        configs = []
        for config_id in get_doc_ids_in_domain_by_class(project_name, ReportConfiguration):
            try:
                configs.append(ReportConfiguration.get(config_id))
            except BadSpecError as e:
                logging.error("%s with report config %s" % (e.message, config_id))

    try:
        configs.extend(StaticReportConfiguration.by_domain(project_name))
    except BadSpecError as e:
        logging.exception(e)

    return configs
Ejemplo n.º 34
0
def _safely_get_report_configs(project_name):
    try:
        configs = ReportConfiguration.by_domain(project_name)
    except BadSpecError as e:
        logging.exception(e)

        # Pick out the UCRs that don't have spec errors
        configs = []
        for config_id in get_doc_ids_in_domain_by_class(project_name, ReportConfiguration):
            try:
                configs.append(ReportConfiguration.get(config_id))
            except BadSpecError as e:
                logging.error("%s with report config %s" % (e.message, config_id))

    try:
        configs.extend(StaticReportConfiguration.by_domain(project_name))
    except BadSpecError as e:
        logging.exception(e)

    return configs
Ejemplo n.º 35
0
def _get_configurable_reports(project):
    """
    User configurable reports
    """
    configs = ReportConfiguration.by_domain(project.name)
    if configs:
        def _make_report_class(config):
            from corehq.apps.reports.generic import GenericReportView

            # this is really annoying.
            # the report metadata should really be pulled outside of the report classes
            @classmethod
            def get_url(cls, domain):
                return reverse(ConfigurableReport.slug, args=[domain, config._id])

            return type('DynamicReport{}'.format(config._id), (GenericReportView, ), {
                'name': config.title,
                'description': config.description,
                'get_url': get_url,
            })

        yield (_('Project Reports'), [_make_report_class(config) for config in configs])
Ejemplo n.º 36
0
    def test_remote_link_ucr(self, fake_ucr_getter):

        fake_ucr_getter.return_value = {
            "report": self.report,
            "datasource": self.data_source,
        }

        # Create
        linked_report_info = create_linked_ucr(self.domain_link,
                                               self.report.get_id)
        self.assertEqual(
            1,
            len(ReportConfiguration.by_domain(self.domain_link.linked_domain)))
        self.assertEqual(self.report.get_id,
                         linked_report_info.report.report_meta.master_id)

        # Update
        self.report.title = "Another new title"
        self.report.save()

        update_linked_ucr(self.domain_link, linked_report_info.report.get_id)
        report = ReportConfiguration.get(linked_report_info.report.get_id)
        self.assertEqual("Another new title", report.title)
Ejemplo n.º 37
0
 def obj_get_list(self, bundle, **kwargs):
     domain = kwargs['domain']
     return ReportConfiguration.by_domain(domain)
Ejemplo n.º 38
0
 def obj_get_list(self, bundle, **kwargs):
     domain = kwargs['domain']
     return ReportConfiguration.by_domain(domain)
Ejemplo n.º 39
0
def _shared_context(domain):
    return {
        'domain': domain,
        'reports': ReportConfiguration.by_domain(domain),
        'data_sources': DataSourceConfiguration.by_domain(domain),
    }
Ejemplo n.º 40
0
def _get_report_builder_reports(project):
    from corehq.apps.userreports.models import ReportConfiguration
    reports = ReportConfiguration.by_domain(project.name)
    return [report for report in reports if report.report_meta.created_by_builder]
Ejemplo n.º 41
0
 def setUp(self):
     super(ReportTranslationTest, self).setUp()
     report = ReportConfiguration.by_domain(self.DOMAIN)[0]
     self.report_source = ReportFactory.from_spec(report)
Ejemplo n.º 42
0
 def setUp(self):
     report = ReportConfiguration.by_domain(self.DOMAIN)[0]
     self.report_source = ReportFactory.from_spec(report)
Ejemplo n.º 43
0
 def setUp(self):
     report = ReportConfiguration.by_domain(self.DOMAIN)[0]
     self.report_source = ReportFactory.from_spec(report)
Ejemplo n.º 44
0
 def setUp(self):
     super(ReportTranslationTest, self).setUp()
     report = ReportConfiguration.by_domain(self.DOMAIN)[0]
     self.report_source = ReportFactory.from_spec(report)
Ejemplo n.º 45
0
def _get_report_builder_reports(project):
    from corehq.apps.userreports.models import ReportConfiguration
    reports = ReportConfiguration.by_domain(project.name)
    return [
        report for report in reports if report.report_meta.created_by_builder
    ]