diff --git a/backend/src/api/import-from-ss.js b/backend/src/api/import-from-ss.js index 89e4b0a..f9a261a 100644 --- a/backend/src/api/import-from-ss.js +++ b/backend/src/api/import-from-ss.js @@ -135,10 +135,10 @@ const addPostWithRetry = async (authors, hash, references, retryDelay = 5000) => const importPaper = async (paper) => { console.log('references count:', paper.references.length); const { paperId } = paper; - const references = paper.references.filter((x) => !!x.paperId); - const eachReferenceWeightPPM = Math.floor(PPM_TO_REFERENCES / references.length); + const paperReferences = paper.references.filter((x) => !!x.paperId); + const eachReferenceWeightPPM = Math.floor(PPM_TO_REFERENCES / paperReferences.length); const references = (await Promise.mapSeries( - references, + paperReferences, 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.