https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=41950
--- Comment #19 from Tomás Cohen Arazi (tcohen) <[email protected]> --- (In reply to Jonathan Druart from comment #15) > 2. It was not clear to me why we couldn't sort by checkout count, so I've > added We couldn't because the `checkouts` *method* doesn't use (internally) the `checkouts` method. So it is resolved as 'non-sortable'. > @ 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 That's the whole point! If you want to make it sortable, it needs to have a relationship with the same name. > 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? The tests fail because they test for a 400, and now they get a 200 I'm pretty sure :-D > Especially because you advertise it in comment 0. It is advertised, but with caveats. I agree we need to document the caveats. They will be documented on the handbook. Where do you think we should document it, and how? What is the sweet spot? -- 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/
