From 7e0a09c870fa2068b8f4755663c705836f8a3a2a Mon Sep 17 00:00:00 2001 From: Elmar Ludwig <elmar.ludwig@uni-osnabrueck.de> Date: Thu, 23 Nov 2023 18:22:24 +0100 Subject: [PATCH] fix counting of matches in widget, fixes #2 --- TandemPlugin.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/TandemPlugin.class.php b/TandemPlugin.class.php index a6bffaa..38b3e26 100644 --- a/TandemPlugin.class.php +++ b/TandemPlugin.class.php @@ -275,7 +275,13 @@ class TandemPlugin extends StudIPPlugin implements SystemPlugin, PortalPlugin, H $pair_requests[$profile->id] = TandemPair::countByProfileAndStatus($profile, 0); if(!$pairs[$profile->id]) { //We're only looking for matches if no pairs have been found. - $match_count[$profile->id] = TandemMatching::countMatches($profile); + $matches = TandemMatching::findMatches($profile); + if (Config::get()->TANDEMPLUGIN_USE_LEVEL) { + $matches = array_filter($matches, function($match) use ($user_id) { + return $match->matchesSpokenLanguages($user_id); + }); + } + $match_count[$profile->id] = count($matches); if($match_count[$profile->id] > 0) { $matches_exist = true; } -- GitLab