Skip to content

Commit 691bb51

Browse files
committed
docs(opportunity): add JSDoc to scoring helper functions
- Document clampScore, computeFreshnessScore, and computeOnboardingClarity - Clarify scoring thresholds and algorithm intent for future contributors
1 parent e4c4594 commit 691bb51

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/services/opportunity.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,15 @@ const LARGE_SCOPE_PATTERNS = [
2626
/\bbreaking change\b/i,
2727
];
2828

29+
/** Clamp a numeric score to the 0–100 integer range. */
2930
function clampScore(value: number): number {
3031
return Math.max(0, Math.min(100, Math.round(value)));
3132
}
3233

34+
/**
35+
* Compute a freshness score based on how recently the issue was updated.
36+
* Issues updated within 24 h score 100; older issues decay toward 42.
37+
*/
3338
function computeFreshnessScore(updatedAt: string): number {
3439
const hours = (Date.now() - new Date(updatedAt).getTime()) / (1000 * 60 * 60);
3540

@@ -41,6 +46,10 @@ function computeFreshnessScore(updatedAt: string): number {
4146
return 42;
4247
}
4348

49+
/**
50+
* Rate onboarding clarity based on labels, body length, and reproduction signals.
51+
* Well-labeled issues with descriptive bodies score higher.
52+
*/
4453
function computeOnboardingClarity(issue: MatchedIssue): number {
4554
const labels = issue.labels.map(normalizeLabel);
4655
const body = issue.body.trim();

0 commit comments

Comments
 (0)