Summary: | Add the Koha::Objects->last method | ||
---|---|---|---|
Product: | Koha | Reporter: | Jonathan Druart <jonathan.druart> |
Component: | Architecture, internals, and plumbing | Assignee: | Jonathan Druart <jonathan.druart> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | katrin.fischer, kyle, m.de.rooy, veron |
Version: | unspecified | ||
Hardware: | All | ||
OS: | All | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Bug Depends on: | |||
Bug Blocks: | 17964 | ||
Attachments: |
Bug 18332: Add the Koha::Objects->last method
Bug 18332: Add the Koha::Objects->last method Bug 18332: Add the Koha::Objects->last method Bug 18332: Add the Koha::Objects->last method Bug 18332: [QA Follow-up] Adjust slice call in last method |
Description
Jonathan Druart
2017-03-24 16:33:16 UTC
Created attachment 61625 [details] [review] Bug 18332: Add the Koha::Objects->last method DBIx::Class does not provide such method, but it can be handy in some cases. Test plan: prove t/db_dependent/Koha/Objects.t should return green Created attachment 61626 [details] [review] Bug 18332: Add the Koha::Objects->last method DBIx::Class does not provide such method, but it can be handy in some cases. Test plan: prove t/db_dependent/Koha/Objects.t should return green Created attachment 61636 [details] [review] Bug 18332: Add the Koha::Objects->last method DBIx::Class does not provide such method, but it can be handy in some cases. Test plan: prove t/db_dependent/Koha/Objects.t should return green Test returned green. Signed-off-by: Marc Véron <veron@veron.ch> Created attachment 61694 [details] [review] Bug 18332: Add the Koha::Objects->last method DBIx::Class does not provide such method, but it can be handy in some cases. Test plan: prove t/db_dependent/Koha/Objects.t should return green Test returned green. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> + my $result = $self->_resultset->slice($count - 1, $count)->first; Why do not do this: my ( $result ) = $self->_resultset->slice($count - 1, $count - 1); Strictly speaking, you call slice with an invalid argument; since the index starts at 0, $count is past the last element. Instead of calling in scalar context and doing first, you should call in list context? Adding a follow-up. Created attachment 61751 [details] [review] Bug 18332: [QA Follow-up] Adjust slice call in last method We should call slice in list context with the correct indexes. Test plan: Run t/db_dependent/Koha/Objects.t Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Pushed to master for 17.05, thanks Jonathan, Marcel! This won't get ported back to 16.11.x as it is an enhancement. |