コード例 #1
0
 def __init__(self, *args, **kwargs):
     from custom.bihar.reports.indicators.indicators import IndicatorConfig, INDICATOR_SETS
     from custom.bihar.reports.indicators.indicators import IndicatorDataProvider
     self.indicator_set = IndicatorConfig(INDICATOR_SETS).get_indicator_set(self.set_slug)
     super(MyPerformanceReport, self).__init__(*args, **kwargs)
     groups = groups_for_user(self.request.couch_user, self.domain)
     self.data_provider = IndicatorDataProvider(
         self.domain, self.indicator_set, groups,
     )
コード例 #2
0
ファイル: utils.py プロジェクト: thedevelopermw/commcare-hq
def get_all_calculations(owner_ids):

    from custom.bihar.reports.indicators.indicators import IndicatorConfig, INDICATOR_SETS

    config = IndicatorConfig(INDICATOR_SETS)
    for indicator_set in config.indicator_sets:
        for indicator in indicator_set.get_indicators():
            slug = indicator.slug
            yield (indicator.name,) + get_calculation(owner_ids, slug)
コード例 #3
0
 def __call__(self, user, version, last_sync=None):
     if user.domain in hard_coded_domains:
         groups = filter(hard_coded_group_filter, Group.by_user(user))
         if len(groups) == 1:
             data_provider = IndicatorDataProvider(
                 domain=user.domain,
                 indicator_set=IndicatorConfig(INDICATOR_SETS).get_indicator_set(hard_coded_indicators),
                 groups=groups,
             )
             return [self.get_fixture(user, data_provider)]
     return []
コード例 #4
0
    def __call__(self, restore_state):
        restore_user = restore_state.restore_user

        if restore_user.domain in hard_coded_domains:
            groups = filter(hard_coded_group_filter, restore_user.get_groups())
            if len(groups) == 1:
                data_provider = IndicatorDataProvider(
                    domain=restore_user.domain,
                    indicator_set=IndicatorConfig(INDICATOR_SETS).
                    get_indicator_set(hard_coded_indicators),
                    groups=groups,
                )
                return [self.get_fixture(restore_user.user_id, data_provider)]
        return []
コード例 #5
0
    def __call__(self, restore_user, version, last_sync=None, app=None):
        assert isinstance(restore_user, OTARestoreUser)

        if restore_user.domain in hard_coded_domains:
            groups = filter(hard_coded_group_filter, restore_user.get_groups())
            if len(groups) == 1:
                data_provider = IndicatorDataProvider(
                    domain=restore_user.domain,
                    indicator_set=IndicatorConfig(INDICATOR_SETS).
                    get_indicator_set(hard_coded_indicators),
                    groups=groups,
                )
                return [self.get_fixture(restore_user.user_id, data_provider)]
        return []
コード例 #6
0
def generator(user, version, last_sync):
    if user.domain in hard_coded_domains:
        groups = filter(hard_coded_group_filter, Group.by_user(user))
        if len(groups) == 1:
            data_provider = IndicatorDataProvider(
                domain=user.domain,
                indicator_set=IndicatorConfig(INDICATOR_SETS).get_indicator_set(hard_coded_indicators),
                groups=groups,
            )
            fixture_provider = IndicatorFixtureProvider(
                hard_coded_fixture_id, user, data_provider
            )
            return [fixture_provider.to_fixture()]
    return []
コード例 #7
0
ファイル: mixins.py プロジェクト: xbryanc/commcare-hq
 def indicator_config(self):
     from custom.bihar.reports.indicators.indicators import INDICATOR_SETS, IndicatorConfig
     return IndicatorConfig(INDICATOR_SETS)
コード例 #8
0
ファイル: mixins.py プロジェクト: xbryanc/commcare-hq
 def indicator_set(self):
     from custom.bihar.reports.indicators.indicators import INDICATOR_SETS, IndicatorConfig
     return IndicatorConfig(INDICATOR_SETS).get_indicator_set(self.indicator_set_slug)