From 5677e842445c95e3f7be0354571bf82eff4e63a3 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 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') --- 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 574a107a6cd..912d1aca209 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 a38ed7ea195..7a9ffdbe204 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.41.0