Collection page shows a different dataset count in the card and the results header
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Read app/routes.py and app/templates/index.html, then compare the count handling with collection_card.html and the dataset page’s parent record adjustment. Use the search result’s total for the collection count and fix the header plural; add a test for a collection with more than 20 datasets. Done when both displayed counts show the total and the header uses the correct plural.
Written by the indexing model from the issue text.
Description
On a collection page, the collection card at the top caps its dataset count at 20, while the results header just below shows the real total. Collections with more than 20 datasets show two different numbers.
- Environment: prod catalog.data.gov
- Component: datagov-catalog, collection view (
/?collection=<identifier>) - Example: https://catalog.data.gov/?collection=US-GOV-SSA-314 (SSI Annual Statistical Report series). The card says "20 datasets in this collection", the results header says "24 dataset in this collection". The collection has 24 datasets (2002 to 2025).
How to reproduce
- Open https://catalog.data.gov/?collection=US-GOV-SSA-314, or click "Explore Collection" on https://catalog.data.gov/dataset/ssi-annual-statistical-report-series
- Compare the count in the collection card with the count in the results header below it.
Expected behavior
- Both counts show 24.
- The header reads "24 datasets", plural.
Actual behavior
- The card shows 20.
app/routes.pysetscollection_data["count"]tolen(interface.search_datasets(...).results), which is the length of one page of results (20 by default), not the total. - The header says "24 dataset" because
app/templates/index.htmluses{{s if total > 1 }}, wheresis an undefined variable rather than the string"s".
Sketch
- Use the search result's
totalfor the collection count instead of the length ofresults(check whether the parent record needs to be excluded, as the dataset page does withresult.total - 1) - Fix the plural in
index.htmlto{{ "s" if total != 1 }}, matchingcollection_card.html - Add a test with a collection of more than 20 datasets
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 207
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 5
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from GSA/data.gov
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Harvester
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
-
blocked form submission shows home pagePossibly taken @FuhuXia claimed this 1 day ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
idle-in-transaction for harvest record selectionPossibly taken @theyottaboy claimed this 15 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Harvester pagination: add page-number navigation to paginationPossibly taken @jaredb96 claimed this 24 days ago. Openbug Harvester
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Similar issues
-
docs(contributing): the two things that silently block a PRPossibly taken A pull request linked to this issue is open or already merged. Openavailable documentation good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 95/100
Nixitov/Riptide-Native#944 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
JTHCode/secretguard#24 ·
Maintainers usually reply within 1 day
-
area: middleware documentation good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 95/100
omarelshamy25x/shamy-hijri#63 ·
Maintainers usually reply within 1 day