Skip to content

Conversation

@PascalRepond
Copy link
Contributor

Previously, issues without claims did not have the issue.claims.counter field indexed, making it impossible to filter by "0 claims" in the late issues view facet.

Now the claims counter is always indexed (0 when no claims exist), allowing users to filter issues that have never been claimed.

Closes #4015.

⚠️ Requires reindexing items of type issue after deployment.

@PascalRepond PascalRepond marked this pull request as ready for review January 22, 2026 10:54
@coderabbitai
Copy link

coderabbitai bot commented Jan 22, 2026

Walkthrough

enrich_item_data now always initializes json["issue"]["claims"] with a counter (0 when no notifications); claim dates are added only if present. A test was added to ensure issues with zero claims are indexed and filterable by claims_count=0.

Changes

Cohort / File(s) Summary
Claims injection logic
rero_ils/modules/items/listener.py
enrich_item_data now unconditionally sets json["issue"]["claims"] (initializes counter to 0 when no claim notifications); attaches creation dates only when available. Previously the claims field was only added when notifications existed.
Zero-claims indexing test
tests/api/items/test_items_issue.py
Added test_issue_claims_counter_indexed_without_claims to verify indexing shows claims.counter == 0, that issue is returned when filtering by claims_count=0, and that no claim dates are present. (The diff includes a duplicated test block.)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(facets): index claims counter for issues without claims' directly and specifically describes the main change: ensuring the claims counter is indexed for all issues.
Description check ✅ Passed The description clearly explains the problem (claims counter not indexed for zero-claim issues), the solution (always index counter), and the benefit (enabling filtering by zero claims).
Linked Issues check ✅ Passed The PR fully addresses #4015 by ensuring the claims counter is always indexed (0 when no claims exist), enabling filtering of issues with zero claims in the facet.
Out of Scope Changes check ✅ Passed All changes are directly related to the objective: listener.py ensures claims counter is always indexed, and test_items_issue.py verifies the claims counter is indexed with value 0.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


No actionable comments were generated in the recent review. 🎉


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coveralls
Copy link

coveralls commented Jan 22, 2026

Coverage Status

coverage: 92.039% (+0.001%) from 92.038%
when pulling 7742275 on PascalRepond:rep-claims
into 9de4b47 on rero:staging.

@PascalRepond PascalRepond requested review from jma and rerowep January 22, 2026 12:09
Previously, issues without claims did not have the `issue.claims.counter`
field indexed, making it impossible to filter by "0 claims" in the late
issues view facet.

Now the claims counter is always indexed (0 when no claims exist),
allowing users to filter issues that have never been claimed.

Closes rero#4015.

:warning: Requires reindexing items of type issue after deployment.

Co-Authored-by: Pascal Repond <[email protected]>
@PascalRepond PascalRepond merged commit 22f9ee0 into rero:staging Feb 10, 2026
5 checks passed
@PascalRepond PascalRepond deleted the rep-claims branch February 10, 2026 11:26
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.

Late issues: display a filter for "0 claims"

4 participants