https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41950 Jonathan Druart <jonathan.druart@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |In Discussion --- Comment #15 from Jonathan Druart <jonathan.druart@gmail.com> --- 1. This needs to be documented somewhere 2. It was not clear to me why we couldn't sort by checkout count, so I've added @ Koha/Schema/Result/Borrower.pm:2271 @ __PACKAGE__->has_many( +__PACKAGE__->has_many( + "checkouts", + "Koha::Schema::Result::Issue", + { "foreign.borrowernumber" => "self.borrowernumber" }, + { cascade_copy => 0, cascade_delete => 0 }, +); And it's now possible: curl -u koha:koha --request GET 'http://dev-intra.localhost/api/v1/patrons?_order_by=+me.checkouts_count' --header "x-koha-embed: checkouts+count" --header "Content-Type: application/json"|jq However the test is now failing. Wouldn't it better to add the relationship directly in dbic as it's certainly one of the biggest need for this feature? Especially because you advertise it in comment 0. -- You are receiving this mail because: You are watching all bug changes.