Bugzilla – Attachment 129152 Details for
Bug 29757
Add filter_by_non_reversible/reversible methods for offsets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29757: (QA follow-up) POD fixes
Bug-29757-QA-follow-up-POD-fixes.patch (text/plain), 3.91 KB, created by
Kyle M Hall (khall)
on 2022-01-07 13:07:54 UTC
(
hide
)
Description:
Bug 29757: (QA follow-up) POD fixes
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2022-01-07 13:07:54 UTC
Size:
3.91 KB
patch
obsolete
>From 4811c6f24ba76811219ce84f809337ccdc30cb60 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 22 Dec 2021 16:49:43 -0300 >Subject: [PATCH] Bug 29757: (QA follow-up) POD fixes > >This patch adds POD, fixes the existing one in the file, and also >renames reversable => reversible as required by the QA scripts. > >If this name change is problematic, I can revert it and resubmit my >follow-up. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/Account/Offsets.pm | 20 ++++++++++++++------ > t/db_dependent/Koha/Account/Offsets.t | 22 +++++++++++----------- > 2 files changed, 25 insertions(+), 17 deletions(-) > >diff --git a/Koha/Account/Offsets.pm b/Koha/Account/Offsets.pm >index 725d4550d85..660ae5a26e3 100644 >--- a/Koha/Account/Offsets.pm >+++ b/Koha/Account/Offsets.pm >@@ -34,14 +34,14 @@ Account offsets track the changes made to the balance of account lines > > =head2 Class methods > >+=head3 total >+ > my $offsets = Koha::Account::Offsets->search({ ... }); > my $total = $offsets->total; > > Returns the sum of the amounts of the account offsets resultset. If the resultset is > empty it returns 0. > >-=head3 total >- > =cut > > sub total { >@@ -60,11 +60,15 @@ sub total { > : 0; > } > >-=head3 filter_by_non_reversable >+=head3 filter_by_non_reversible >+ >+ my $non_reversible = $debit->->search(..)->filter_by_non_reversible; >+ >+Filter offsets so only non-reversible ones are left in the resultset. > > =cut > >-sub filter_by_non_reversable { >+sub filter_by_non_reversible { > my ($self) = @_; > > my $me = $self->_resultset()->current_source_alias; >@@ -82,11 +86,15 @@ sub filter_by_non_reversable { > return $self->search( $where, $attr ); > } > >-=head3 filter_by_reversable >+=head3 filter_by_reversible >+ >+ my $reversible = Koha::Account::Offsets->search(..)->filter_by_reversible; >+ >+Filter offsets so only non ones are left in the resultset. > > =cut > >-sub filter_by_reversable { >+sub filter_by_reversible { > my ($self) = @_; > > my $me = $self->_resultset()->current_source_alias; >diff --git a/t/db_dependent/Koha/Account/Offsets.t b/t/db_dependent/Koha/Account/Offsets.t >index 9aea5df7ad6..54365f92b0f 100755 >--- a/t/db_dependent/Koha/Account/Offsets.t >+++ b/t/db_dependent/Koha/Account/Offsets.t >@@ -73,7 +73,7 @@ subtest 'total() tests' => sub { > $schema->storage->txn_rollback; > }; > >-subtest 'filter_by_non_reversable() and filter_by_reversable() tests' => sub { >+subtest 'filter_by_non_reversible() and filter_by_reversible() tests' => sub { > > plan tests => 4; > >@@ -90,16 +90,16 @@ subtest 'filter_by_non_reversable() and filter_by_reversable() tests' => sub { > $account->pay( { amount => 4, type => 'PAYMENT' } ); > $account->pay( { amount => 5, type => 'CREDIT' } ); > >- # non-reversable offsets >- is( $manual_fee->debit_offsets->filter_by_non_reversable->count, >- 3, '3 non-reversable offsets' ); >- is( $manual_fee->debit_offsets->filter_by_non_reversable->total, >- -6, '-6 the total amount of the non-reversable offsets' ); >- # reversable offsets >- is( $manual_fee->debit_offsets->filter_by_reversable->count, >- 2, 'The right reversable offsets count' ); >- is( $manual_fee->debit_offsets->filter_by_reversable->total, >- -5, 'The right total amount of the reversable offsets' ); >+ # non-reversible offsets >+ is( $manual_fee->debit_offsets->filter_by_non_reversible->count, >+ 3, '3 non-reversible offsets' ); >+ is( $manual_fee->debit_offsets->filter_by_non_reversible->total, >+ -6, '-6 the total amount of the non-reversible offsets' ); >+ # reversible offsets >+ is( $manual_fee->debit_offsets->filter_by_reversible->count, >+ 2, 'The right reversible offsets count' ); >+ is( $manual_fee->debit_offsets->filter_by_reversible->total, >+ -5, 'The right total amount of the reversible offsets' ); > > $schema->storage->txn_rollback; > }; >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 29757
:
128865
|
128866
|
128867
|
129150
|
129151
|
129152
|
129178
|
129179
|
129180
|
129296