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.