From d515f936b1cdf2b0bc6dbe33f9827695069e5b71 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Sat, 28 Feb 2026 17:30:02 +0000 Subject: [PATCH] v12 --- partners.php | 116 ++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 106 insertions(+), 10 deletions(-) diff --git a/partners.php b/partners.php index 1347b81..dd94de7 100644 --- a/partners.php +++ b/partners.php @@ -23,6 +23,40 @@ if (!$user['onboarding_completed']) { exit; } +// Skill-based Matching Helper +function calculateMatchScore($me, $them) { + $score = 0; + + // 1. My preferred skills vs Their skills + $myNeeds = array_filter(array_map('trim', explode(',', strtolower($me['preferred_co_founder_skills'] ?? '')))); + $theirSkills = array_filter(array_map('trim', explode(',', strtolower($them['skills'] ?? '')))); + $skillMatches = array_intersect($myNeeds, $theirSkills); + $score += count($skillMatches) * 10; + + // 2. Their preferred skills vs My skills + $theirNeeds = array_filter(array_map('trim', explode(',', strtolower($them['preferred_co_founder_skills'] ?? '')))); + $mySkills = array_filter(array_map('trim', explode(',', strtolower($me['skills'] ?? '')))); + $reciprocalMatches = array_intersect($theirNeeds, $mySkills); + $score += count($reciprocalMatches) * 10; + + // 3. Industry overlap + $myIndustries = array_filter(array_map('trim', explode(',', strtolower($me['startup_industries'] ?? '')))); + $theirIndustries = array_filter(array_map('trim', explode(',', strtolower($them['startup_industries'] ?? '')))); + $industryMatches = array_intersect($myIndustries, $theirIndustries); + $score += count($industryMatches) * 5; + + // 4. University match (bonus) + if (!empty($me['university']) && $me['university'] === $them['university']) { + $score += 5; + } + + return [ + 'total' => $score, + 'skillMatches' => array_values($skillMatches), + 'industryMatches' => array_values($industryMatches) + ]; +} + // Handle Swipe Logic if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['action']) && $_POST['action'] === 'swipe') { header('Content-Type: application/json'); @@ -66,7 +100,7 @@ $stmt = db()->prepare(" $stmt->execute([$current_user_id, $current_user_id, $current_user_id]); $matches = $stmt->fetchAll(); -// Fetch swipe candidates +// Fetch swipe candidates with scoring $stmt = db()->prepare(" SELECT * FROM users WHERE role = 'founder' @@ -74,11 +108,17 @@ $stmt = db()->prepare(" AND onboarding_completed = 1 AND looking_for_cofounder = 1 AND id NOT IN (SELECT swiped_id FROM swipes WHERE swiper_id = ?) - ORDER BY RAND() - LIMIT 10 + LIMIT 50 "); $stmt->execute([$current_user_id, $current_user_id]); -$swipeCandidates = $stmt->fetchAll(); +$allCandidates = $stmt->fetchAll(); + +foreach ($allCandidates as &$c) { + $c['match_data'] = calculateMatchScore($user, $c); + $c['score'] = $c['match_data']['total']; +} +usort($allCandidates, function($a, $b) { return $b['score'] <=> $a['score']; }); +$swipeCandidates = array_slice($allCandidates, 0, 10); // Fetch partners for Browse view $search = $_GET['q'] ?? ''; @@ -91,10 +131,18 @@ if ($search) { $params[] = "%$search%"; $params[] = "%$search%"; } -$stmt = db()->prepare("SELECT * FROM users WHERE $where LIMIT 20"); +$stmt = db()->prepare("SELECT * FROM users WHERE $where LIMIT 40"); $stmt->execute($params); $browseCandidates = $stmt->fetchAll(); +foreach ($browseCandidates as &$c) { + $c['match_data'] = calculateMatchScore($user, $c); + $c['score'] = $c['match_data']['total']; +} +if (!$search) { + usort($browseCandidates, function($a, $b) { return $b['score'] <=> $a['score']; }); +} + $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; ?> @@ -221,6 +269,23 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; justify-content: center; font-size: 100px; color: rgba(255,255,255,0.2); + position: relative; + } + .match-badge { + position: absolute; + top: 20px; + right: 20px; + background: rgba(0,0,0,0.6); + backdrop-filter: blur(10px); + padding: 8px 16px; + border-radius: 50px; + color: var(--accent-blue); + font-weight: 700; + font-size: 14px; + border: 1px solid var(--accent-blue); + display: flex; + align-items: center; + gap: 8px; } .card-details { padding: 25px; flex-grow: 1; display: flex; flex-direction: column; } .card-title { font-size: 26px; font-weight: 800; margin-bottom: 5px; } @@ -228,6 +293,7 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; .card-bio { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 15px; } .card-tags { display: flex; flex-wrap: wrap; gap: 8px; } .card-tag { font-size: 11px; padding: 5px 12px; background: rgba(255,255,255,0.05); border-radius: 20px; border: 1px solid var(--border-color); } + .card-tag.highlight { border-color: var(--accent-blue); color: var(--accent-blue); background: rgba(0, 242, 255, 0.05); } .swipe-actions { display: flex; gap: 20px; margin-top: 30px; } .action-btn { @@ -251,11 +317,22 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; padding: 25px; transition: transform 0.3s; cursor: pointer; + position: relative; } .candidate-card:hover { transform: translateY(-5px); border-color: var(--accent-blue); } .candidate-header { display: flex; gap: 15px; align-items: center; margin-bottom: 20px; } .candidate-avatar { width: 60px; height: 60px; border-radius: 18px; background: var(--gradient-primary); display: flex; align-items: center; justify-content: center; font-weight: 700; color: #fff; font-size: 20px; } + .score-indicator { + position: absolute; + top: 25px; + right: 25px; + font-size: 11px; + font-weight: 700; + color: var(--accent-blue); + text-transform: uppercase; + } + /* Match Modal */ #match-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; @@ -334,6 +411,9 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
+ = 10): ?> +
% Compatible
+ @@ -347,8 +427,15 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
- + $myNeeds = array_map('trim', explode(',', strtolower($user['preferred_co_founder_skills'] ?? ''))); + foreach (array_slice($skills, 0, 4) as $skill): + if(empty(trim($skill))) continue; + $isNeeded = in_array(trim(strtolower($skill)), $myNeeds); + ?> + + ' : '' ?> + +
@@ -374,6 +461,9 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
+ = 10): ?> +
Top Match
+
@@ -393,8 +483,14 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
- + $myNeeds = array_map('trim', explode(',', strtolower($user['preferred_co_founder_skills'] ?? ''))); + foreach (array_slice($skills, 0, 3) as $skill): + if(empty(trim($skill))) continue; + $isNeeded = in_array(trim(strtolower($skill)), $myNeeds); + ?> + + +
@@ -488,4 +584,4 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; - + \ No newline at end of file