From a377be6afeee435ef9804063941111ddc4077f96 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') Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- 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.39.5