ss import: clarify log and output when no papers found
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 34s
Details
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 34s
Details
This commit is contained in:
parent
1948e81733
commit
afbfc0c0f2
|
@ -231,7 +231,11 @@ module.exports = async (req, res) => {
|
|||
const papers = await fetchAuthorPapers(authorId);
|
||||
console.log('papers count:', papers.length);
|
||||
const result = await Promise.mapSeries(papers, importPaper);
|
||||
console.log(`Added posts for ${result.length} papers by author ${authorId}`);
|
||||
if (result.length) {
|
||||
console.log(`Added posts for ${result.length} papers by author ${authorId}`);
|
||||
}
|
||||
res.json(result);
|
||||
} else {
|
||||
res.status(400).end();
|
||||
}
|
||||
};
|
||||
|
|
|
@ -13,10 +13,14 @@ function ImportPapersByAuthor() {
|
|||
.catch((error) => {
|
||||
setStatus(`Error: ${error.response?.data ?? error.message}`);
|
||||
});
|
||||
const getStatus = ({ paperId, postId, alreadyAdded }) => (alreadyAdded
|
||||
? `Paper ${paperId} was already imported as post ${postId}`
|
||||
: `Imported paper ${paperId} as post ${postId}`);
|
||||
setStatus(results.map(getStatus).join('\n'));
|
||||
if (results?.length) {
|
||||
const getStatus = ({ paperId, postId, alreadyAdded }) => (alreadyAdded
|
||||
? `Paper ${paperId} was already imported as post ${postId}`
|
||||
: `Imported paper ${paperId} as post ${postId}`);
|
||||
setStatus(results.map(getStatus).join('\n'));
|
||||
} else {
|
||||
setStatus(`Found 0 papers by author ${authorId}`);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
|
|
Loading…
Reference in New Issue