https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=38122 Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ayoub.glizi-vicioso@inLibro | |.com --- Comment #106 from Ayoub Glizi-Vicioso <ayoub.glizi-vicioso@inLibro.com> --- I came across this issue, that is not deal breaking but is worth noting: https://snipboard.io/AGCdJY.jpg When grouping statuses,It would be useful to group sub-statuses as well.. This is the solution I am proposing: diff --git a/Koha/REST/V1/Biblios.pm b/Koha/REST/V1/Biblios.pm index 4c45319b3c..f5bc737313 100644 --- a/Koha/REST/V1/Biblios.pm +++ b/Koha/REST/V1/Biblios.pm @@ -271,12 +271,21 @@ sub get_items { $items_rs = $items_rs->filter_by_bookable if $bookable_only; if ($group_by_status) { + my $sub_status_order = [ + { -asc => 'me.itemlost' }, + { -asc => 'me.notforloan' }, + { -desc => 'me.restricted' } + ]; + my @item_ids; for my $status ( qw( available checked_out local_use in_transit lost withdrawn damaged not_for_loan on_hold recalled in_bundle restricted ) ) { - push @item_ids, $items_rs->search( { _status => $status } )->get_column('itemnumber'); + push @item_ids, $items_rs->search( + { _status => $status }, + { order_by => $sub_status_order } + )->get_column('itemnumber'); } I ran benchmark tests using ApacheBench for the same bibliographic record (~500 items displayed on a single page), with and without this sub-status filter applied. I observed no significant performance difference between both cases: Without sub-status filtering: - Average response time: ~10 254 ms - Longest request: ~13.0 s With sub-status filtering: - Average response time: ~10 208 ms - Longest request: ~13.6 s The differences observed are within normal variance and do not indicate any measurable performance impact. If this addition is considered relevant, it can be included; otherwise, it is not necessary. -- You are receiving this mail because: You are watching all bug changes.