Bugzilla – Attachment 82099 Details for
Bug 20750
Allow timestamped auditing of ILL request events
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20750: (follow-up) Fix sorting of log entries
Bug-20750-follow-up-Fix-sorting-of-log-entries.patch (text/plain), 1.40 KB, created by
Andrew Isherwood
on 2018-11-08 15:39:08 UTC
(
hide
)
Description:
Bug 20750: (follow-up) Fix sorting of log entries
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2018-11-08 15:39:08 UTC
Size:
1.40 KB
patch
obsolete
>From 7aefff7540353dc7216276b60edc3ec4ac97ee55 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Thu, 18 Oct 2018 16:08:03 +0100 >Subject: [PATCH] Bug 20750: (follow-up) Fix sorting of log entries > >The log entries are received from C4::Log::GetLogs with their timestamps >formatted as '2018-18-10 16:09:29', this doesn't sort well. In fact, it >causes a warning in the Koha logs: > >Argument "2018-10-04 15:48:15" isn't numeric in numeric comparison (<=>) >at /home/koha/kohaclone/Koha/Illrequest/Logger.pm line 231 > >This patch converts the timestamps to be sorted into epoch dates prior >to them being compared >--- > Koha/Illrequest/Logger.pm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/Koha/Illrequest/Logger.pm b/Koha/Illrequest/Logger.pm >index 6cfa3031b3..5643ecde80 100644 >--- a/Koha/Illrequest/Logger.pm >+++ b/Koha/Illrequest/Logger.pm >@@ -19,6 +19,7 @@ package Koha::Illrequest::Logger; > > use Modern::Perl; > use JSON qw( to_json from_json ); >+use Time::Piece; > > use C4::Context; > use C4::Templates; >@@ -228,7 +229,8 @@ sub get_request_logs { > ); > } > >- my @sorted = sort {$$b{'timestamp'} <=> $$a{'timestamp'}} @{$logs}; >+ my $format = '%Y-%m-%d %H:%M:%S'; >+ my @sorted = sort {Time::Piece->strptime($$b{'timestamp'}, $format)->epoch <=> Time::Piece->strptime($$a{'timestamp'}, $format)->epoch} @{$logs}; > > return \@sorted; > } >-- >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 20750
:
75304
|
75326
|
75329
|
75330
|
77757
|
77816
|
77817
|
77818
|
77931
|
79822
|
79823
|
79824
|
80860
|
82082
|
82083
|
82085
|
82096
|
82097
|
82098
|
82099
|
82500
|
82501
|
82502
|
84193
|
84194
|
84195
|
84203
|
84266
|
84497
|
84498
|
84821
|
84823
|
84824
|
84825
|
84826
|
84827
|
84973
|
84974
|
84975
|
84976
|
84977
|
84978
|
84979
|
85097
|
85098
|
85099
|
85101
|
85113
|
85238
|
85266
|
85697
|
85698
|
85699
|
85700
|
85701
|
85702
|
85703
|
85704
|
85705
|
85706
|
85707
|
85708
|
85709
|
85710
|
85756
|
85757
|
85765
|
85826
|
85827
|
85829
|
85830
|
85831
|
85832
|
85833
|
85834
|
85835
|
85836
|
85837
|
85838
|
85839
|
85840
|
85841
|
85842
|
85843
|
85844
|
85845
|
85846
|
85847
|
85848
|
86434
|
86435
|
86436
|
86534
|
86535
|
86536