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 <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Martin Renvoize 2023-10-11 17:52:43 +01:00 committed by Tomas Cohen Arazi
parent 66b6c3e936
commit a377be6afe
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
2 changed files with 2 additions and 2 deletions

View file

@ -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;

View file

@ -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' );