Collection page shows a different dataset count in the card and the results header

Aperta Adatta ai principianti
#6,566 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
82/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
django, python

Direzione di ricerca

Leggi app/routes.py e app/templates/index.html, poi confronta la gestione del conteggio con collection_card.html e l’adeguamento del record padre della pagina del dataset. Usa il totale del risultato della ricerca per il conteggio della raccolta e correggi il plurale nell’intestazione; aggiungi un test per una raccolta con più di 20 dataset. Il lavoro è completato quando entrambi i conteggi visualizzati mostrano il totale e l’intestazione usa il plurale corretto.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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

  1. 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
  2. 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.py sets collection_data["count"] to len(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.html uses {{s if total > 1 }}, where s is an undefined variable rather than the string "s".

Sketch

  • Use the search result's total for the collection count instead of the length of results (check whether the parent record needs to be excluded, as the dataset page does with result.total - 1)
  • Fix the plural in index.html to {{ "s" if total != 1 }}, matching collection_card.html
  • Add a test with a collection of more than 20 datasets
Lingua principale
Python
Stelle
1.2k
Fork
207
Merge medio
3g 16h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di GSA/data.gov

Tutte le issue di GSA/data.gov

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.