From c6db89309a11fe86cedd0533e167db8b4f66754d Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 3 Sep 2019 13:35:27 +0200 Subject: [PATCH] BankTransaction: Sortierungscode vereinfacht --- SL/Controller/BankTransaction.pm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/SL/Controller/BankTransaction.pm b/SL/Controller/BankTransaction.pm index 844dad521..36494038d 100644 --- a/SL/Controller/BankTransaction.pm +++ b/SL/Controller/BankTransaction.pm @@ -230,11 +230,8 @@ sub action_list { # sort bank transaction proposals by quality (score) of proposal if ($::form->{sort_by} && $::form->{sort_by} eq 'proposal') { - if ($::form->{sort_dir}) { - $bank_transactions = [ sort { $a->{agreement} <=> $b->{agreement} } @{ $bank_transactions } ]; - } else { - $bank_transactions = [ sort { $b->{agreement} <=> $a->{agreement} } @{ $bank_transactions } ]; - } + my $dir = $::form->{sort_dir} ? 1 : -1; + $bank_transactions = [ sort { ($a->{agreement} <=> $b->{agreement}) * $dir } @{ $bank_transactions } ]; } # for testing with t/bank/banktransaction.t : -- 2.20.1