···229229 console.log(`Records with DID: ${recordsWithDid.length}`);
230230 }
231231232232- // Create a map of month -> count
232232+ // Create a map of month -> count (filter for 2025+)
233233 const monthlyCounts = new Map<string, number>();
234234235235+ // Filter data to only include 2025 and later
236236+ const data2025Plus = dailyData?.filter(entry => {
237237+ const year = new Date(entry.created_at).getFullYear();
238238+ return year >= 2025;
239239+ });
240240+235241 // Get the earliest and latest dates to ensure all months are included
236236- if (dailyData && dailyData.length > 0) {
237237- const dates = dailyData.map(e => new Date(e.created_at));
242242+ if (data2025Plus && data2025Plus.length > 0) {
243243+ const dates = data2025Plus.map(e => new Date(e.created_at));
238244 const minDate = new Date(Math.min(...dates.map(d => d.getTime())));
239245 const maxDate = new Date(Math.max(...dates.map(d => d.getTime())));
240246241241- // Initialize all months with 0
242242- const currentMonth = new Date(minDate.getFullYear(), minDate.getMonth(), 1);
247247+ // Initialize all months with 0 (starting from Jan 2025 or the earliest date)
248248+ const startMonth = new Date(Math.max(minDate.getTime(), new Date(2025, 0, 1).getTime()));
249249+ const currentMonth = new Date(startMonth.getFullYear(), startMonth.getMonth(), 1);
243250 const endMonth = new Date(maxDate.getFullYear(), maxDate.getMonth(), 1);
244251245252 while (currentMonth <= endMonth) {
···249256 }
250257251258 // Process each entry to get monthly counts
252252- dailyData.forEach(entry => {
259259+ data2025Plus.forEach(entry => {
253260 const date = new Date(entry.created_at);
254261 const monthKey = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`;
255262···415422 }
416423 });
417424418418- // Convert to array and sort by count to get top 10 DIDs
419419- const top10Dids = Array.from(didCounts.entries())
425425+ // Convert to array and sort by count to get top 15 DIDs (fetch extra in case some have 0)
426426+ const top15Dids = Array.from(didCounts.entries())
420427 .sort((a, b) => b[1] - a[1])
421421- .slice(0, 10)
428428+ .slice(0, 15)
422429 .map(([did]) => did);
423430424424- console.log(`Top 10 DIDs from Supabase ranking: ${top10Dids.join(', ')}`);
431431+ console.log(`Top 15 DIDs from Supabase ranking: ${top15Dids.join(', ')}`);
425432426426- // Now fetch true counts from Bluesky API for these top 10 DIDs
427427- console.log('Fetching true counts from Bluesky API for top 10 users...');
433433+ // Now fetch true counts from Bluesky API for these top 15 DIDs
434434+ console.log('Fetching true counts from Bluesky API for top 15 users...');
428435 const leaderboardWithTrueCounts = await Promise.all(
429429- top10Dids.map(async (did) => {
436436+ top15Dids.map(async (did) => {
430437 const trueCount = await fetchTrueCountFromBluesky(did);
431438 const supabaseCount = didCounts.get(did) || 0;
432439···440447 })
441448 );
442449443443- // Sort by true count (descending) in case the order changed, and filter out 0s
450450+ // Sort by true count (descending) in case the order changed, filter out 0s, and take top 10
444451 const leaderboard = leaderboardWithTrueCounts
445452 .filter(item => item.count > 0) // Only include users with at least 1 flush
446446- .sort((a, b) => b.count - a.count);
453453+ .sort((a, b) => b.count - a.count)
454454+ .slice(0, 10); // Take top 10 after filtering
447455448456 console.log(`Leaderboard after filtering (${leaderboard.length} users with flushes > 0)`);
449457
+33-24
src/app/profile/[handle]/page.tsx
···370370 const perDay = parseFloat((userEntries.length / activeDaysCount).toFixed(1));
371371 setFlushesPerDay(perDay);
372372373373- // Generate chart data (group by month)
373373+ // Generate chart data (group by month) - filter for 2025 and later
374374 const chartDataMap = new Map<string, number>();
375375376376- // Get the earliest and latest dates
377377- const dates = userEntries.map(e => new Date(e.created_at));
378378- const minDate = new Date(Math.min(...dates.map(d => d.getTime())));
379379- const maxDate = new Date(Math.max(...dates.map(d => d.getTime())));
376376+ // Filter entries to only include 2025 and later
377377+ const entries2025Plus = userEntries.filter((entry: FlushingEntry) => {
378378+ const year = new Date(entry.created_at).getFullYear();
379379+ return year >= 2025;
380380+ });
380381381381- // Initialize all months with 0
382382- const currentMonth = new Date(minDate.getFullYear(), minDate.getMonth(), 1);
383383- const endMonth = new Date(maxDate.getFullYear(), maxDate.getMonth(), 1);
384384-385385- while (currentMonth <= endMonth) {
386386- const monthKey = `${currentMonth.getFullYear()}-${String(currentMonth.getMonth() + 1).padStart(2, '0')}`;
387387- chartDataMap.set(monthKey, 0);
388388- currentMonth.setMonth(currentMonth.getMonth() + 1);
389389- }
390390-391391- // Group entries by month
392392- userEntries.forEach((entry: FlushingEntry) => {
393393- const date = new Date(entry.created_at);
394394- const monthKey = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`;
382382+ if (entries2025Plus.length > 0) {
383383+ // Get the earliest and latest dates from 2025+ entries
384384+ const dates = entries2025Plus.map(e => new Date(e.created_at));
385385+ const minDate = new Date(Math.min(...dates.map(d => d.getTime())));
386386+ const maxDate = new Date(Math.max(...dates.map(d => d.getTime())));
387387+388388+ // Initialize all months with 0 (starting from Jan 2025 or the earliest date)
389389+ const startMonth = new Date(Math.max(minDate.getTime(), new Date(2025, 0, 1).getTime()));
390390+ const currentMonth = new Date(startMonth.getFullYear(), startMonth.getMonth(), 1);
391391+ const endMonth = new Date(maxDate.getFullYear(), maxDate.getMonth(), 1);
395392396396- if (chartDataMap.has(monthKey)) {
397397- chartDataMap.set(monthKey, chartDataMap.get(monthKey)! + 1);
398398- } else {
399399- chartDataMap.set(monthKey, 1);
393393+ while (currentMonth <= endMonth) {
394394+ const monthKey = `${currentMonth.getFullYear()}-${String(currentMonth.getMonth() + 1).padStart(2, '0')}`;
395395+ chartDataMap.set(monthKey, 0);
396396+ currentMonth.setMonth(currentMonth.getMonth() + 1);
400397 }
401401- });
398398+399399+ // Group entries by month
400400+ entries2025Plus.forEach((entry: FlushingEntry) => {
401401+ const date = new Date(entry.created_at);
402402+ const monthKey = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, '0')}`;
403403+404404+ if (chartDataMap.has(monthKey)) {
405405+ chartDataMap.set(monthKey, chartDataMap.get(monthKey)! + 1);
406406+ } else {
407407+ chartDataMap.set(monthKey, 1);
408408+ }
409409+ });
410410+ }
402411403412 // Convert map to array and sort by date
404413 const chartDataArray = Array.from(chartDataMap.entries())