Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Only show count of datasets on dashboard org page #8082

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions changes/8082.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Only show the count of an org's datasets on the dashboard organization list (not harvesters, showcases, etc.).
2 changes: 1 addition & 1 deletion ckan/lib/dictization/model_dictize.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def _get_members(context: Context, group: model.Group,
def get_group_dataset_counts() -> dict[str, Any]:
'''For all public groups, return their dataset counts, as a SOLR facet'''
query = search.PackageSearchQuery()
q: dict[str, Any] = {'q': '',
q: dict[str, Any] = {'q': '', 'fq': 'dataset_type:dataset',
'fl': 'groups', 'facet.field': ['groups', 'owner_org'],
'facet.limit': -1, 'rows': 1}
query.run(q)
Expand Down
2 changes: 2 additions & 0 deletions ckan/tests/lib/dictization/test_model_dictize.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,8 @@ def test_group_dictize_for_org_with_package_count(self):
org_obj = factories.Organization.model()
other_org_ = factories.Organization()
factories.Dataset(owner_org=org_obj.id)
# only actual datasets should be returned
factories.Dataset(owner_org=org_obj.id, type="not_dataset")
factories.Dataset(owner_org=other_org_["id"])
context = {
"model": model,
Expand Down