fix: correct misleading sort order comments

Co-authored-by: Ona <no-reply@ona.com>
This commit is contained in:
2026-03-01 17:25:03 +00:00
parent 65ca50bf36
commit f806b78fb7

View File

@@ -338,7 +338,7 @@ export class FeedEngine<TItems extends FeedItem = FeedItem> {
} }
} }
// Apply boost reordering: positive-boost first (desc), then zero, then negative (asc). // Apply boost reordering: positive-boost first (desc), then zero, then negative (desc).
// Stable sort within each tier preserves original relative order. // Stable sort within each tier preserves original relative order.
if (boostScores.size > 0) { if (boostScores.size > 0) {
currentItems = applyBoostOrder(currentItems, boostScores) currentItems = applyBoostOrder(currentItems, boostScores)
@@ -524,7 +524,7 @@ function applyBoostOrder<T extends FeedItem>(items: T[], boostScores: Map<string
} }
} }
// Sort positive descending by boost, negative ascending (most negative last) // Sort positive descending by boost, negative descending (least negative first, most negative last)
positive.sort((a, b) => { positive.sort((a, b) => {
const aScore = clamp(boostScores.get(a.id) ?? 0, -1, 1) const aScore = clamp(boostScores.get(a.id) ?? 0, -1, 1)
const bScore = clamp(boostScores.get(b.id) ?? 0, -1, 1) const bScore = clamp(boostScores.get(b.id) ?? 0, -1, 1)