[Bug 42679] New: Add GET /patrons/{patron_id}/overdues_count endpoint
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Bug ID: 42679 Summary: Add GET /patrons/{patron_id}/overdues_count endpoint Initiative type: --- Sponsorship --- status: Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: REST API Assignee: koha-bugs@lists.koha-community.org Reporter: tomascohen@gmail.com QA Contact: testopia@bugs.koha-community.org CC: tomascohen@gmail.com Add a new REST API endpoint that returns the count of overdue checkouts for a patron as a plain integer. This endpoint computes the count live from the database (date_due < NOW()) to ensure accuracy, as overdue status is time-based with no discrete event to trigger updates. The primary use case is async loading in the patron search table: the main search results render immediately while overdues are fetched separately per visible page, improving perceived performance. Endpoint: GET /api/v1/patrons/{patron_id}/overdues_count Response: integer (e.g. 3) Permission: borrowers => list_borrowers -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|koha-bugs@lists.koha-commun |tomascohen@gmail.com |ity.org | Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 --- Comment #1 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 199502 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199502&action=edit Bug 42679: Add GET /patrons/{patron_id}/overdues_count endpoint Returns the count of overdue checkouts for a patron as a plain integer. Computed live from the database (date_due < NOW()) to ensure accuracy, as overdue status is time-based with no discrete event to trigger updates. This endpoint is intended for async loading in the patron search table, allowing the main search results to render immediately while overdues are fetched separately per visible page. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/patrons_overdues_count.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199502|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 --- Comment #2 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 199503 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199503&action=edit Bug 42679: Add GET /patrons/{patron_id}/overdues_count endpoint Returns the count of overdue checkouts for a patron as a plain integer. Computed live from the database (date_due < NOW()) to ensure accuracy, as overdue status is time-based with no discrete event to trigger updates. This endpoint is intended for async loading in the patron search table, allowing the main search results to render immediately while overdues are fetched separately per visible page. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/patrons_overdues_count.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42682 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42682 [Bug 42682] Elasticsearch-powered patron search -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199503|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 --- Comment #3 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- Created attachment 199511 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199511&action=edit Bug 42679: Add GET /patrons/{patron_id}/overdues_count endpoint Returns the count of overdue checkouts for a patron as a plain integer. Computed live from the database (date_due < NOW()) to ensure accuracy, as overdue status is time-based with no discrete event to trigger updates. This endpoint is intended for async loading in the patron search table, allowing the main search results to render immediately while overdues are fetched separately per visible page. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/patrons_overdues_count.t => SUCCESS: Tests pass! 3. Sign off :-D -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #199511|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 199523 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199523&action=edit Bug 42679: Add GET /patrons/{patron_id}/overdues_count endpoint Returns the count of overdue checkouts for a patron as a plain integer. Computed live from the database (date_due < NOW()) to ensure accuracy, as overdue status is time-based with no discrete event to trigger updates. This endpoint is intended for async loading in the patron search table, allowing the main search results to render immediately while overdues are fetched separately per visible page. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/patrons_overdues_count.t => SUCCESS: Tests pass! 3. Sign off :-D Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |42508 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42508 [Bug 42508] Migrate patron search to Elastic -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |In Discussion CC| |jonathan.druart@gmail.com --- Comment #5 from Jonathan Druart <jonathan.druart@gmail.com> --- You already can embed overdues+count on /patrons. Alternatively, if you need something fast you can filter on checkouts: /api/v1/patrons/51/checkouts?_page=1&_per_page=1&q=[{%22due_date%22:{%22%3C%22:%222026-06-23T23:59:00+00:00%22}}] fetch 1 and read the header "X-Total-Count". -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42679 Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Signed Off --- Comment #6 from Tomás Cohen Arazi (tcohen) <tomascohen@gmail.com> --- (In reply to Jonathan Druart from comment #5)
You already can embed overdues+count on /patrons.
You got it wrong. I don't plan to search patrons using the API in this case, and embedding such things is painful in rendering times. Please look at my work on ES patron search, and the DB-only counterpart. I think they are self-explanatory. I already compared all ways of retrieving the information. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org