|
8 | 8 | import { getMergedPRs } from "lib/data-retrieval/getMergedPRs" |
9 | 9 | import { getAllPRs } from "lib/data-retrieval/getAllPRs" |
10 | 10 | import { getBountiedIssues } from "lib/data-retrieval/getBountiedIssues" |
11 | | -import { getIssuesCreated } from "lib/data-retrieval/getIssuesCreated" |
| 11 | +import { getRecentIssues } from "lib/data-retrieval/getRecentIssues" |
12 | 12 | import { getLastWednesday } from "lib/ai/date-utils" |
13 | 13 | import { analyzePRWithAI } from "lib/ai-stuff/analyze-pr" |
14 | 14 | import { processDiscussionsForContributors } from "lib/data-retrieval/processDiscussions" |
@@ -179,31 +179,40 @@ export async function generateOverview(startDate: string) { |
179 | 179 | // Wait for all bounty fetching to complete |
180 | 180 | await Promise.all(bountiedIssuesPromises) |
181 | 181 |
|
182 | | - const getIssuesCreatedPromises = Object.keys(contributorData).map( |
183 | | - async (contributor) => { |
184 | | - const { totalIssues, majorIssues } = await getIssuesCreated( |
185 | | - repo, |
186 | | - contributor, |
187 | | - startDateString, |
188 | | - ) |
| 182 | + const recentIssues = await getRecentIssues(repo, startDateString) |
| 183 | + const issuesByAuthor: Record<string, { total: number; major: number }> = {} |
189 | 184 |
|
190 | | - console.log( |
191 | | - `Processed issues created for ${contributor} - totalIssues: ${totalIssues} - majorIssues: ${majorIssues} in ${repo}`, |
| 185 | + for (const issue of recentIssues) { |
| 186 | + const author = issue.user?.login |
| 187 | + if (!author || !contributorData[author]) continue |
| 188 | + if (!issuesByAuthor[author]) { |
| 189 | + issuesByAuthor[author] = { total: 0, major: 0 } |
| 190 | + } |
| 191 | + issuesByAuthor[author].total++ |
| 192 | + if ( |
| 193 | + issue.labels.some( |
| 194 | + (label) => |
| 195 | + typeof label === "object" && label.name?.toLowerCase() === "major", |
192 | 196 | ) |
| 197 | + ) { |
| 198 | + issuesByAuthor[author].major++ |
| 199 | + } |
| 200 | + } |
193 | 201 |
|
194 | | - contributorData[contributor].issuesCreated = |
195 | | - (contributorData[contributor].issuesCreated || 0) + totalIssues |
| 202 | + for (const [contributor, counts] of Object.entries(issuesByAuthor)) { |
| 203 | + console.log( |
| 204 | + `Processed issues created for ${contributor} - totalIssues: ${counts.total} - majorIssues: ${counts.major} in ${repo}`, |
| 205 | + ) |
196 | 206 |
|
197 | | - // Calculate score based on issues created |
198 | | - const scoreFromIssues = |
199 | | - Math.min(totalIssues, 5) * 0.5 + majorIssues * 1.5 |
| 207 | + contributorData[contributor].issuesCreated = |
| 208 | + (contributorData[contributor].issuesCreated || 0) + counts.total |
200 | 209 |
|
201 | | - contributorData[contributor].score = |
202 | | - (contributorData[contributor].score || 0) + scoreFromIssues |
203 | | - }, |
204 | | - ) |
| 210 | + const scoreFromIssues = |
| 211 | + Math.min(counts.total, 5) * 0.5 + counts.major * 1.5 |
205 | 212 |
|
206 | | - await Promise.all(getIssuesCreatedPromises) |
| 213 | + contributorData[contributor].score = |
| 214 | + (contributorData[contributor].score || 0) + scoreFromIssues |
| 215 | + } |
207 | 216 | } |
208 | 217 | // Process GitHub Discussions for all contributors |
209 | 218 | const allGithubDiscussions = await processDiscussionsForContributors( |
|
0 commit comments