diff --git a/index.html b/index.html
index 329a4f8..0b21c7f 100644
--- a/index.html
+++ b/index.html
@@ -1876,10 +1876,9 @@
Related resources
} else if (state.sort === 'new') {
return new Date(b.updated) - new Date(a.updated);
} else if (state.sort === 'engaging') {
- const rateA = (statsA.upvotes + 2) / (statsA.views + 40);
- const rateB = (statsB.upvotes + 2) / (statsB.views + 40);
- if (rateB !== rateA) return rateB - rateA;
- return statsB.upvotes - statsA.upvotes;
+ if (statsA.upvotes !== statsB.upvotes) return statsB.upvotes - statsA.upvotes;
+ if (statsA.views !== statsB.views) return statsB.views - statsA.views;
+ return a.name.localeCompare(b.name);
}
return 0;
});
diff --git a/tools/catalog-build/build-stats.js b/tools/catalog-build/build-stats.js
index e498a5b..4bd5113 100644
--- a/tools/catalog-build/build-stats.js
+++ b/tools/catalog-build/build-stats.js
@@ -325,12 +325,10 @@ function mapDiscussions(discussions, knownSlugs, explicitMap) {
discussions.find(item => item.title.includes(slug));
}
if (!discussion) continue;
- const thumbsUp = discussion.reactionGroups?.find(group => group.content === 'THUMBS_UP');
- const count = thumbsUp?.reactors?.totalCount;
- if (!Number.isInteger(count) || count < 0) {
- console.warn(`Warning: discussion #${discussion.number} has no THUMBS_UP count.`);
- continue;
- }
+ const count = (discussion.reactionGroups ?? []).reduce((sum, group) => {
+ const total = group?.reactors?.totalCount;
+ return sum + (Number.isInteger(total) && total > 0 ? total : 0);
+ }, 0);
result.set(slug, {
upvotes: count,
discussion: { number: discussion.number, url: discussion.url }