Esempio n. 1
0
def _get_config_entry(config, domain):
    return Entry(
        command=Command(
            id='reports.{}'.format(config.uuid),
            text=Text(locale=Locale(id=id_strings.report_name(config.uuid)), ),
        ),
        datums=[
            SessionDatum(
                detail_select=MobileSelectFilterHelpers.get_select_detail_id(
                    config, filter_slug),
                id=MobileSelectFilterHelpers.get_datum_id(config, filter_slug),
                nodeset=MobileSelectFilterHelpers.get_options_nodeset(
                    config, filter_slug),
                value='./@value',
            ) for filter_slug, f in MobileSelectFilterHelpers.get_filters(
                config, domain)
        ] + [
            SessionDatum(
                detail_confirm=_get_summary_detail_id(config),
                detail_select=_get_select_detail_id(config),
                id='report_id_{}'.format(config.uuid),
                nodeset="instance('reports')/reports/report[@id='{}']".format(
                    config.uuid),
                value='./@id',
                autoselect="true"),
        ])
Esempio n. 2
0
    def _get_config_entry(self, config):
        if self.new_mobile_ucr_restore:
            nodeset = "instance('commcare-reports:{}')/rows".format(
                config.instance_id)
        else:
            nodeset = "instance('reports')/reports/report[@id='{}']".format(
                config.uuid)

        datums = []

        if self.report_module.report_context_tile:
            datums.append(get_report_context_tile_datum())

        datums += [
            SessionDatum(
                detail_select=MobileSelectFilterHelpers.get_select_detail_id(
                    config, filter_slug),
                id=MobileSelectFilterHelpers.get_datum_id(config, filter_slug),
                nodeset=MobileSelectFilterHelpers.get_options_nodeset(
                    config, filter_slug, self.new_mobile_ucr_restore),
                value='./@value',
            ) for filter_slug, f in MobileSelectFilterHelpers.get_filters(
                config, self.domain)
        ] + [
            SessionDatum(detail_confirm=_get_summary_detail_id(config),
                         detail_select=_get_select_detail_id(config),
                         id='report_id_{}'.format(config.uuid),
                         nodeset=nodeset,
                         value='./@id',
                         autoselect="true"),
        ]

        return Entry(
            command=Command(
                id='reports.{}'.format(config.uuid),
                text=Text(
                    locale=Locale(id=id_strings.report_name(config.uuid)), ),
            ),
            datums=datums,
        )