From 345c71b6eafdfe665419a7cd73177e3e9a445c15 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sun, 15 Mar 2026 01:56:01 +0000 Subject: [PATCH] fix: address code review feedback - topStreak edge case, remove unused var Co-authored-by: qinfendebingshuo <207279273+qinfendebingshuo@users.noreply.github.com> --- scripts/generate-daily-report.js | 1 - scripts/sync-dev-status.js | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/generate-daily-report.js b/scripts/generate-daily-report.js index d2e16ac8..f3b979ca 100644 --- a/scripts/generate-daily-report.js +++ b/scripts/generate-daily-report.js @@ -179,7 +179,6 @@ function generateReport(devStatus, activity) { // 项目概览 const activeDevs = team.filter(d => d.status !== 'paused').length; const summary = devStatus.summary || {}; - const graduatedCount = summary.graduated_modules?.length || 0; const report = `# 🌊 光湖开发日报 · ${dateStr} diff --git a/scripts/sync-dev-status.js b/scripts/sync-dev-status.js index e221c7d1..158cd892 100644 --- a/scripts/sync-dev-status.js +++ b/scripts/sync-dev-status.js @@ -133,7 +133,9 @@ function mapNotionStatus(status) { function generateSummary(team) { const activeCount = team.filter(d => d.status === 'active').length; const waitingSyslog = team.filter(d => d.status === 'waiting_syslog').length; - const topStreak = team.reduce((max, d) => d.streak > max.streak ? d : max, { streak: 0 }); + const topStreakDev = team.length > 0 + ? team.reduce((max, d) => d.streak > max.streak ? d : max, team[0]) + : null; const alerts = team .filter(d => d.waiting && d.waiting.includes('⚠️')) .map(d => `${d.dev_id} ${d.name}: ${d.waiting}`); @@ -142,7 +144,7 @@ function generateSummary(team) { total_devs: team.length, active_waiting_syslog: waitingSyslog, active_normal: activeCount, - top_streak: topStreak.dev_id ? `${topStreak.dev_id} ${topStreak.name} ${topStreak.streak}连胜` : '无', + top_streak: topStreakDev ? `${topStreakDev.dev_id} ${topStreakDev.name} ${topStreakDev.streak}连胜` : '无', alerts, }; }