https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41950
--- Comment #23 from Tomás Cohen Arazi (tcohen) <[email protected]> --- Created attachment 198982 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=198982&action=edit Bug 41950: (follow-up) Add DBIC relationship aliases for +count embeds Adds DBIC relationship aliases so that +count embeds advertised in the API specs are backed by actual database relationships, making them sortable via the SQL COUNT subquery infrastructure. New aliases: - Borrower: checkouts (issues), overdues (issues + date_due < NOW()) - Aqbookseller: baskets (aqbaskets), invoices (aqinvoices) - Ticket: updates (ticket_updates) - ErmEholdingsPackage: resources (erm_eholdings_resources) - Biblio: holds (reserves) The overdues relationship uses a DBIC coderef condition to filter on date_due < NOW(). _build_count_subquery is extended to handle coderef conditions, enabling SQL-level sorting on filtered counts. Koha methods are updated to use the new relationship names directly. Test plan: 1. Apply patch 2. Run: $ ktd --shell k$ prove t/Koha/REST/Plugin/Query.t \ t/db_dependent/api/v1/patrons.t \ t/db_dependent/api/v1/acquisitions_vendors.t \ t/db_dependent/Koha/REST/Plugin/Objects.t => SUCCESS: All tests pass 3. Verify overdues+count sorting works: GET /api/v1/patrons x-koha-embed: overdues+count _order_by: -me.overdues_count => SUCCESS: Patrons sorted by overdue count (filtered, not all checkouts) 4. Sign off :-D Assisted-by: Sonnet 4.6 (Anthropic) -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list [email protected] https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
