Bugzilla – Attachment 66986 Details for
Bug 19277
TT syntax - Data is not ordered in notices
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19277: Make sure the tests will pass even if they are slow
Bug-19277-Make-sure-the-tests-will-pass-even-if-th.patch (text/plain), 3.92 KB, created by
Jonathan Druart
on 2017-09-08 12:46:17 UTC
(
hide
)
Description:
Bug 19277: Make sure the tests will pass even if they are slow
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-09-08 12:46:17 UTC
Size:
3.92 KB
patch
obsolete
>From 69d1b97242e6559e714738c2a8b635018261d840 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 8 Sep 2017 09:41:21 -0300 >Subject: [PATCH] Bug 19277: Make sure the tests will pass even if they are > slow > >This patch was my first attempt to fix the issue. >I think it is good to have it, if issue.timestamp and issue.issuedate are the same, >the result will be orderd by issue_id. >The tests highlight the fact that checkouts must be displayed in the >correct order. >--- > C4/Members.pm | 9 +++++---- > t/db_dependent/Letters/TemplateToolkit.t | 14 ++++++++++---- > 2 files changed, 15 insertions(+), 8 deletions(-) > >diff --git a/C4/Members.pm b/C4/Members.pm >index 166b051e74..f31ef8d40c 100644 >--- a/C4/Members.pm >+++ b/C4/Members.pm >@@ -1129,11 +1129,12 @@ sub IssueSlip { > } > } > >- # Sort on timestamp then on issuedate (useful for tests and could be if modified in a batch >+ # Sort on timestamp then on issuedate then on issue_id >+ # useful for tests and could be if modified in a batch > @issues = sort { >- my $s = $b->{timestamp} <=> $a->{timestamp}; >- $s == 0 ? >- $b->{issuedate} <=> $a->{issuedate} : $s; >+ $b->{timestamp} <=> $a->{timestamp} >+ or $b->{issuedate} <=> $a->{issuedate} >+ or $b->{issue_id} <=> $a->{issue_id} > } @issues; > > my ($letter_code, %repeat, %loops); >diff --git a/t/db_dependent/Letters/TemplateToolkit.t b/t/db_dependent/Letters/TemplateToolkit.t >index f85825f8a7..611b936d6a 100644 >--- a/t/db_dependent/Letters/TemplateToolkit.t >+++ b/t/db_dependent/Letters/TemplateToolkit.t >@@ -600,6 +600,8 @@ EOF > plan tests => 2; > > my $code = 'ISSUESLIP'; >+ my $now = dt_from_string; >+ my $one_minute_ago = dt_from_string->subtract( minutes => 1 ); > > my $branchcode = $library->{branchcode}; > >@@ -647,10 +649,12 @@ EOF > > reset_template( { template => $template, code => $code, module => 'circulation' } ); > >- C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout >+ my $checkout = C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout >+ $checkout->set_columns( { timestamp => $now, issuedate => $one_minute_ago } )->update; # FIXME $checkout is a Koha::Schema::Result::Issues, must be a Koha::Checkout > my $first_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); > >- C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout >+ $checkout = C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout >+ $checkout->set_columns( { timestamp => $now, issuedate => $now } )->update; > my $yesterday = dt_from_string->subtract( days => 1 ); > C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue > my $second_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); >@@ -705,10 +709,12 @@ EOF > > reset_template( { template => $tt_template, code => $code, module => 'circulation' } ); > >- C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout >+ $checkout = C4::Circulation::AddIssue( $patron, $item1->{barcode} ); # Add a first checkout >+ $checkout->set_columns( { timestamp => $now, issuedate => $one_minute_ago } )->update; > my $first_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); > >- C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout >+ $checkout = C4::Circulation::AddIssue( $patron, $item2->{barcode} ); # Add a second checkout >+ $checkout->set_columns( { timestamp => $now, issuedate => $now } )->update; > C4::Circulation::AddIssue( $patron, $item3->{barcode}, $yesterday ); # Add an overdue > my $second_tt_slip = C4::Members::IssueSlip( $branchcode, $patron->{borrowernumber} ); > >-- >2.11.0
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 19277
:
66985
|
66986
|
67000
|
67001
|
67043
|
67044