• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

rero / rero-ils / 30270388542
91%
staging: 91%

Build:
Build:
LAST BUILD BRANCH: wep-remove-cypress
DEFAULT BRANCH: staging
Ran 27 Jul 2026 02:13PM UTC
Jobs 1
Files 613
Run time 2min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

27 Jul 2026 01:27PM UTC coverage: 91.359% (+0.05%) from 91.305%
30270388542

push

github

PascalRepond
fix(documents): count documents instead of holdings in org facet

The organisation -> library -> location facet is built on the
`nested_holdings` nested field, so terms sub-aggregations count holdings,
not documents: counts were inflated whenever a document had several
holdings in the same bucket.

Add a `reverse_nested` sub-aggregation (`record_count`) at each level to
count distinct parent documents, and expose it as `doc_count` in the
serializer.

Order the terms buckets by `record_count` in the query so the `size` cut
keeps the buckets with the most documents: Elasticsearch orders terms by
holdings count by default, so a library or location with many documents
but few holdings could otherwise be dropped before the serializer sees it.
The query now returns the buckets already ordered by document count, so
the serializer no longer re-sorts them.

Drop the `sum_other_doc_count` and `doc_count_error_upper_bound` terms
metadata: they still describe the holdings-count aggregation and no longer
match the rewritten (document-count) buckets. They cannot be recomputed for
documents, as a document may belong to several buckets.

* Closes #4003.

Co-Authored-by: Johnny Mariéthoz <johnny.mariethoz@rero.ch>
Co-Authored-by: Ana Gomes <anagoncalves7@icloud.com>

17 of 17 new or added lines in 1 file covered. (100.0%)

229 existing lines in 19 files now uncovered.

24338 of 26640 relevant lines covered (91.36%)

0.91 hits per line

Coverage Regressions

Lines Coverage ∆ File
58
92.57
0.09% rero_ils/dojson/utils.py
51
84.62
0.0% rero_ils/modules/utils.py
33
88.14
-0.16% rero_ils/modules/documents/dojson/contrib/jsontomarc21/model.py
19
75.96
24.92% rero_ils/modules/stats/views.py
11
87.3
0.0% rero_ils/modules/notifications/dispatcher.py
10
91.98
-0.03% rero_ils/modules/documents/dojson/contrib/unimarctojson/model.py
8
73.56
1.61% rero_ils/modules/stats/serializers.py
8
87.3
0.0% rero_ils/query.py
6
75.0
-4.63% rero_ils/modules/babel_extractors.py
6
96.72
0.02% rero_ils/modules/patrons/views.py
5
93.39
-0.21% rero_ils/modules/migrations/data/views.py
3
92.45
-5.66% rero_ils/modules/entities/remote_entities/utils.py
2
90.63
-0.63% rero_ils/modules/imports/api.py
2
93.85
0.0% rero_ils/modules/notifications/tasks.py
2
94.12
0.37% rero_ils/modules/serializers/response.py
2
80.0
-1.25% rero_ils/modules/stats/api/indicators/base.py
1
96.52
0.0% rero_ils/modules/api.py
1
99.55
0.0% rero_ils/modules/documents/views.py
1
89.74
-0.85% rero_ils/modules/entities/remote_entities/api.py
Jobs
ID Job ID Ran Files Coverage
1 30270388542.1 27 Jul 2026 02:13PM UTC 613
91.36
GitHub Action Run
Source Files on build 30270388542
  • Tree
  • List 613
  • Changed 49
  • Source Changed 46
  • Coverage Changed 31
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #30270388542
  • 9c6b1996 on github
  • Prev Build on ils-dev (#29751578344)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc