ignore cited papers with no authors
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 40s Details

This commit is contained in:
Ladd Hoffman 2024-04-26 22:48:52 -05:00
parent 6a644097fe
commit b1b59e6df5
1 changed files with 11 additions and 7 deletions

View File

@ -146,19 +146,23 @@ const importPaper = async (paper) => {
const { paperId } = paper;
const references = paper.references.filter((x) => !!x.paperId);
const eachCitationWeightPercent = Math.floor(PPM_TO_CITATIONS / references.length);
const citations = await Promise.mapSeries(
const citations = (await Promise.mapSeries(
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.
// The forum allows dangling citations to support this use case.
const citedPost = await generatePost(citedPaper);
return {
weightPPM: eachCitationWeightPercent,
targetPostId: citedPost.hash,
};
try {
const citedPost = await generatePost(citedPaper);
return {
weightPPM: eachCitationWeightPercent,
targetPostId: citedPost.hash,
};
} catch (e) {
return null;
}
},
);
)).filter((x) => !!x);
// Make sure citation weights sum to the designated total
if (citations.length) {