From f1bb21c9ad9f21da58a08bf23ad0a01899ecb5f2 Mon Sep 17 00:00:00 2001 From: Ladd Hoffman Date: Sun, 21 Apr 2024 12:51:38 -0500 Subject: [PATCH] fixup citation weights for ss import --- backend/src/import-from-ss.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/import-from-ss.js b/backend/src/import-from-ss.js index db0f2fc..86ac5a4 100644 --- a/backend/src/import-from-ss.js +++ b/backend/src/import-from-ss.js @@ -152,9 +152,10 @@ module.exports = async (req, res) => { console.log('references count:', paper.references.length); - const eachCitationWeightPercent = Math.floor(PPM_TO_CITATIONS / paper.references.length); + const references = paper.references.filter((x) => !!x.paperId); + const eachCitationWeightPercent = Math.floor(PPM_TO_CITATIONS / references.length); const citations = await Promise.mapSeries( - paper.references.filter((x) => !!x.paperId), + references, async (citedPaper) => { // We need to fetch this paper so we can generate the post we WOULD add to the forum. // That way, if we later add the cited paper to the blockchain it will have the correct hash.