diff --git a/dashboard.php b/dashboard.php index 84ba79f..2230015 100644 --- a/dashboard.php +++ b/dashboard.php @@ -32,15 +32,14 @@ if ($user['role'] === 'founder' && $user['onboarding_completed'] == 0) { $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby'; -// Identify Trending Startups (Top 3 in followers or funding this week) +// Identify Trending Startups (Top 3 in followers or funding) $trendingIds = []; // Top 3 Followed $stmt = db()->prepare(" SELECT s.id FROM startups s - JOIN startup_followers sf ON s.id = sf.startup_id - WHERE sf.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY) + LEFT JOIN startup_followers sf ON s.id = sf.startup_id GROUP BY s.id ORDER BY COUNT(sf.id) DESC LIMIT 3 @@ -49,14 +48,11 @@ $stmt->execute(); $topFollowed = $stmt->fetchAll(PDO::FETCH_COLUMN); $trendingIds = array_merge($trendingIds, $topFollowed); -// Top 3 Funded +// Top 3 Funded (Total) $stmt = db()->prepare(" - SELECT s.id - FROM startups s - JOIN investments i ON s.id = i.startup_id - WHERE i.status = 'approved' AND i.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY) - GROUP BY s.id - ORDER BY SUM(i.amount) DESC + SELECT id + FROM startups + ORDER BY funding_raised DESC LIMIT 3 "); $stmt->execute(); diff --git a/discover.php b/discover.php index 0021e12..9bb3b61 100644 --- a/discover.php +++ b/discover.php @@ -32,14 +32,13 @@ $blocked_by_ids = $stmt->fetchAll(PDO::FETCH_COLUMN); $all_blocked = array_unique(array_merge($blocked_ids, $blocked_by_ids)); $placeholders = empty($all_blocked) ? "0" : implode(',', array_fill(0, count($all_blocked), '?')); -// Leaderboard: Most Followed This Week +// Leaderboard: Most Followed (All Time) $sql = " SELECT s.id, s.name, s.description, u.full_name as founder_name, COUNT(sf.id) as followers_count FROM startups s JOIN users u ON s.founder_id = u.id - JOIN startup_followers sf ON s.id = sf.startup_id - WHERE sf.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY) - AND u.id NOT IN ($placeholders) + LEFT JOIN startup_followers sf ON s.id = sf.startup_id + WHERE u.id NOT IN ($placeholders) GROUP BY s.id ORDER BY followers_count DESC LIMIT 10 @@ -48,15 +47,12 @@ $stmt = db()->prepare($sql); $stmt->execute($all_blocked ?: []); $mostFollowed = $stmt->fetchAll(); -// Leaderboard: Most Funded This Week +// Leaderboard: Most Funded (All Time) $sql = " - SELECT s.id, s.name, s.description, u.full_name as founder_name, SUM(i.amount) as funded_amount + SELECT s.id, s.name, s.description, u.full_name as founder_name, s.funding_raised as funded_amount FROM startups s JOIN users u ON s.founder_id = u.id - JOIN investments i ON s.id = i.startup_id - WHERE i.status = 'approved' AND i.created_at >= DATE_SUB(NOW(), INTERVAL 7 DAY) - AND u.id NOT IN ($placeholders) - GROUP BY s.id + WHERE u.id NOT IN ($placeholders) ORDER BY funded_amount DESC LIMIT 10 "; @@ -120,7 +116,10 @@ $platformName = defined('PLATFORM_NAME') ? PLATFORM_NAME : 'Gatsby';
- + + <?= htmlspecialchars($platformName) ?> Logo + +