Bug 28130: (QA follow-up) Use schema result to fetch alerts to allow for prefetch

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Nick Clemens 2023-07-21 12:56:51 +00:00 committed by Tomas Cohen Arazi
parent e790f75c0d
commit 73739dd0b6
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -2710,8 +2710,7 @@ Return a Koha::Subscriptions object containing subscriptions for which the patro
sub alert_subscriptions {
my ( $self ) = @_;
my $schema = Koha::Database->new->schema;
my @alerts = $schema->resultset('Alert')->search({ borrowernumber => $self->borrowernumber });
my @alerts = $self->_result->alerts;
my @subscription_ids = map { $_->externalid } @alerts;
return Koha::Subscriptions->search({ subscriptionid => \@subscription_ids });