From 2b83d63d8a4a8d4115afcc7f969ad2cac8050f7a Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 11 Oct 2023 17:52:43 +0100 Subject: [PATCH] Bug 15504: (follow-up) Rename cache key Content-Type: text/plain; charset=utf-8 I agree, it's better to use borrowernumber for the cache key and I also take the oportunity to rename it to more clearly reflect the function (it's no longer 'login' only, it's now 'activity') Signed-off-by: Marcel de Rooy --- Koha/Patron.pm | 2 +- t/db_dependent/Koha/Patron.t | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Koha/Patron.pm b/Koha/Patron.pm index 574a107a6c..912d1aca20 100644 --- a/Koha/Patron.pm +++ b/Koha/Patron.pm @@ -1186,7 +1186,7 @@ sub update_lastseen { return $self unless $tracked_activities->{$activity}; my $cache = Koha::Caches->get_instance(); - my $cache_key = "track_login_" . $self->userid; + my $cache_key = "track_activity_" . $self->borrowernumber; my $cached = $cache->get_from_cache($cache_key); my $now = dt_from_string(); return if $cached && $cached eq $now->ymd; diff --git a/t/db_dependent/Koha/Patron.t b/t/db_dependent/Koha/Patron.t index dc0558790a..0139d3825e 100755 --- a/t/db_dependent/Koha/Patron.t +++ b/t/db_dependent/Koha/Patron.t @@ -1964,7 +1964,7 @@ subtest 'update_lastseen tests' => sub { $patron->store(); my $cache = Koha::Caches->get_instance(); - my $cache_key = "track_login_" . $patron->userid; + my $cache_key = "track_activity_" . $patron->borrowernumber; $cache->clear_from_cache($cache_key); t::lib::Mocks::mock_preference( 'TrackLastPatronActivity', '1' ); -- 2.30.2