Exemplo n.º 1
0
def count_fixture_items(domain, data_type_id):
    from corehq.apps.fixtures.models import FixtureDataItem
    return FixtureDataItem.view(
        'fixtures/data_items_by_domain_type',
        startkey=[domain, data_type_id],
        endkey=[domain, data_type_id, {}],
        reduce=True,
    ).first()['value']
Exemplo n.º 2
0
def get_fixture_items_by_data_type(domain, data_type_id, bypass_cache=False):
    from corehq.apps.fixtures.models import FixtureDataItem
    return list(
        FixtureDataItem.view('fixtures/data_items_by_domain_type',
                             key=[domain, data_type_id],
                             reduce=False,
                             include_docs=True,
                             descending=True))
Exemplo n.º 3
0
def get_fixture_items_for_data_types(domain, data_type_ids, bypass_cache=False):
    from corehq.apps.fixtures.models import FixtureDataItem
    return list(FixtureDataItem.view(
        'fixtures/data_items_by_domain_type',
        keys=[[domain, id] for id in data_type_ids],
        reduce=False,
        include_docs=True,
        descending=True
    ))