From 6a1c6b68f9459b6ed87b0f1ceb7573aafc9bc8b7 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Tue, 7 Feb 2012 14:40:19 -0500 Subject: [PATCH] Tpac (etc): improve payment history sorting/paging Payments within a transaction will have the same timestamp. With a large enough set of such payments, sorting by timestamp alone when retrieving payments is not enough to guarantee unique pages of payments. This adds a secondary sort on payment ID as a tie-breaker. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 627ee87bcc..3fa922c152 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -3710,11 +3710,18 @@ sub user_payments { } } }, - order_by => [{ # by default, order newest payments first - class => 'mp', - field => 'payment_ts', - direction => 'desc' - }] + order_by => [ + { # by default, order newest payments first + class => 'mp', + field => 'payment_ts', + direction => 'desc' + }, { + # secondary sort in ID as a tie-breaker, since payments created + # within the same transaction will have identical payment_ts's + class => 'mp', + field => 'id' + } + ] }; for (qw/order_by limit offset/) { -- 2.11.0