Skip to content

UoE/Return all rows in lower-level usage reports (#807) - #37

Merged
milanmajchrak merged 3 commits into
datashare-UoEMainLibrary-dspace-8_xfrom
uoe/statistics-pagination-lower-levels-807
Jul 20, 2026
Merged

UoE/Return all rows in lower-level usage reports (#807)#37
milanmajchrak merged 3 commits into
datashare-UoEMainLibrary-dspace-8_xfrom
uoe/statistics-pagination-lower-levels-807

Conversation

@jr-rk

@jr-rk jr-rk commented Jul 17, 2026

Copy link
Copy Markdown

Summary

Resolves the backend half of dataquest-dev/dspace-customers#807: community/collection/item statistics tables rendered pagination (from DSpace#726) but had nothing to page — the backend capped the rows before the UI ever saw them. This PR returns all rows so the existing client-side pagination works on every table.

Changes

  • File visits (TotalDownloads): bitstream rows were hardcoded to 10 → new usage-statistics.topDownloadsLimit = -1 (non-positive = all rows).
  • TopCountries / TopCities: defaults 100 → -1; shared getConfiguredLimit() maps non-positive to Integer.MAX_VALUE (SolrLogger treats only -1 as "skip facet limit", which falls back to Solr's facet.limit=100).
  • Total visits per month: startDateInterval -6 → -60 (5 years of browsable months) and DSO-axis max 10 → -1 so the report takes the direct date-range facet path and zero-fills empty months even on an empty statistics core (also fixes an order-dependent IT).
  • ITs: unlimited + capped downloads, configurable month window, unlimited country/city limits; month-expectation helper now derives the window from config.

Connected PRs

Notes

  • Full StatisticsRestRepositoryIT class green locally: 50/50 tests.
  • No merge yet — branch will be finetuned and reviewed live on a local instance.

After fix:

community-totalvisits-per-month item-file-visits item-top-country-views item-top-city-views

🤖 Generated with Claude Code

Lower-level statistics tables (File visits, Top countries/cities,
visits per month) were starved by backend caps, so the UI's
client-side pagination had nothing to page through.

- new usage-statistics.topDownloadsLimit (bitstream rows were
  hardcoded to 10); topCountriesLimit/topCitiesLimit defaults
  100 -> -1; non-positive maps to Integer.MAX_VALUE because
  SolrLogger treats only -1 as "skip facet limit" and Solr then
  caps at facet.limit=100
- widen startDateInterval -6 -> -60 so the month report exposes
  5 years of browsable history
- month report DSO axis max 10 -> -1: takes the direct date-range
  facet path, which zero-fills months even when the statistics
  core has no matching docs; also fixes the order-dependent
  usageReportsSearch_Collection_NotVisited IT
- IT month helper now derives the window from config; new ITs for
  unlimited/capped downloads, configurable window, and unlimited
  country/city limits

Refs dataquest-dev/dspace-customers#807

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the statistics usage-report backend to stop prematurely capping result rows, so the existing client-side pagination can page through complete datasets (items, bitstreams, countries/cities, and month windows).

Changes:

  • Adds configurable “unlimited” row limits (non-positive ⇒ effectively unlimited) for downloads/country/city reports and refactors limit-handling into a shared helper.
  • Expands the default “Total visits per month” window to 5 years and adjusts dataset generation to ensure month buckets are returned/zero-filled even when the statistics core is empty.
  • Extends integration tests to cover unlimited vs capped behavior and makes month expectations derive from configuration.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
dspace/config/modules/usage-statistics.cfg Adds/updates config defaults to remove hard caps (downloads/countries/cities) and widens the month window.
dspace-server-webapp/src/main/java/org/dspace/app/rest/utils/UsageReportUtils.java Implements configurable limits (non-positive ⇒ “no limit”) and adjusts month report generation behavior.
dspace-server-webapp/src/test/java/org/dspace/app/rest/StatisticsRestRepositoryIT.java Adds IT coverage for new limit semantics and derives month expectations from config.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

jr-rk and others added 2 commits July 17, 2026 19:30
Emit month points most-recent-first so the current month lands on
the first pagination page and users page backwards through history.

Refs dataquest-dev/dspace-customers#807

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Address Copilot review on PR #37.

- wrap the four new tests that set topDownloadsLimit /
  topCountriesLimit / topCitiesLimit in try/finally so the values
  are restored; config is not reset between ITs and leaking them
  can make later tests order-dependent
- rename getListOfVisitsPerMonthsPoints param viewsLastMonth ->
  viewsCurrentMonth (it applies to the current month, i == 0)

Refs dataquest-dev/dspace-customers#807

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@jr-rk
jr-rk requested a review from milanmajchrak July 17, 2026 20:01
@milanmajchrak
milanmajchrak merged commit 80b0319 into datashare-UoEMainLibrary-dspace-8_x Jul 20, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants