mirror of
https://github.com/zyachel/quetre.git
synced 2025-04-04 13:37:39 +03:00
fix: fix a couple of NaN
s
This commit is contained in:
parent
f1efdf33e4
commit
71587d0db4
4 changed files with 34 additions and 37 deletions
|
@ -21,7 +21,7 @@ const feedAnswerCleaner = answer => ({
|
||||||
numComments: answer.numDisplayComments,
|
numComments: answer.numDisplayComments,
|
||||||
numUpvotes: answer.numUpvotes,
|
numUpvotes: answer.numUpvotes,
|
||||||
numViews: answer.numViews,
|
numViews: answer.numViews,
|
||||||
numShares: answer.numSharers,
|
numShares: answer.numShares,
|
||||||
numAnswerRequests: answer.numRequesters,
|
numAnswerRequests: answer.numRequesters,
|
||||||
isBusinessAnswer: answer.businessAnswer,
|
isBusinessAnswer: answer.businessAnswer,
|
||||||
author: {
|
author: {
|
||||||
|
@ -55,7 +55,7 @@ const feedPostCleaner = post => ({
|
||||||
numComments: post.numDisplayComments,
|
numComments: post.numDisplayComments,
|
||||||
numUpvotes: post.numUpvotes,
|
numUpvotes: post.numUpvotes,
|
||||||
numViews: post.numViews,
|
numViews: post.numViews,
|
||||||
numShares: post.numSharers,
|
numShares: post.numShares,
|
||||||
author: {
|
author: {
|
||||||
uid: post.author.uid,
|
uid: post.author.uid,
|
||||||
isAnon: post.author.isAnon,
|
isAnon: post.author.isAnon,
|
||||||
|
|
|
@ -54,8 +54,7 @@ const answerCleaner = ({ question, previewAnswer: answer }) => ({
|
||||||
},
|
},
|
||||||
...(answer.originalQuestionIfDifferent && {
|
...(answer.originalQuestionIfDifferent && {
|
||||||
originalQuestion: {
|
originalQuestion: {
|
||||||
text: JSON.parse(answer.originalQuestionIfDifferent.question.title)
|
text: JSON.parse(answer.originalQuestionIfDifferent.question.title).sections,
|
||||||
.sections,
|
|
||||||
url: quetrefy(answer.originalQuestionIfDifferent.question.url),
|
url: quetrefy(answer.originalQuestionIfDifferent.question.url),
|
||||||
qid: answer.originalQuestionIfDifferent.question.qid,
|
qid: answer.originalQuestionIfDifferent.question.qid,
|
||||||
},
|
},
|
||||||
|
@ -67,7 +66,7 @@ const answerCleaner = ({ question, previewAnswer: answer }) => ({
|
||||||
numComments: answer.numDisplayComments,
|
numComments: answer.numDisplayComments,
|
||||||
numUpvotes: answer.numUpvotes,
|
numUpvotes: answer.numUpvotes,
|
||||||
numViews: answer.numViews,
|
numViews: answer.numViews,
|
||||||
numShares: answer.numSharers,
|
numShares: answer.numShares,
|
||||||
numAnswerRequests: answer.numRequesters,
|
numAnswerRequests: answer.numRequesters,
|
||||||
isBusinessAnswer: answer.businessAnswer,
|
isBusinessAnswer: answer.businessAnswer,
|
||||||
url: quetrefy(answer.url),
|
url: quetrefy(answer.url),
|
||||||
|
@ -97,7 +96,7 @@ const postCleaner = post => ({
|
||||||
numComments: post.numDisplayComments,
|
numComments: post.numDisplayComments,
|
||||||
numUpvotes: post.numUpvotes,
|
numUpvotes: post.numUpvotes,
|
||||||
numViews: post.numViews,
|
numViews: post.numViews,
|
||||||
numShares: post.numSharers,
|
numShares: post.numShares,
|
||||||
author: {
|
author: {
|
||||||
uid: post.author.uid,
|
uid: post.author.uid,
|
||||||
isAnon: post.author.isAnon,
|
isAnon: post.author.isAnon,
|
||||||
|
|
|
@ -25,36 +25,35 @@ const getTopic = async (slug, lang) => {
|
||||||
404
|
404
|
||||||
);
|
);
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
tid: rawData.tid,
|
tid: rawData.tid,
|
||||||
name: rawData.name,
|
name: rawData.name,
|
||||||
url: quetrefy(rawData.url),
|
url: quetrefy(rawData.url),
|
||||||
image: rawData.photoUrl,
|
image: rawData.photoUrl,
|
||||||
aliases: rawData.aliases,
|
aliases: rawData.aliases,
|
||||||
numFollowers: rawData.numFollowers,
|
numFollowers: rawData.numFollowers,
|
||||||
numQuestions: rawData.numQuestions,
|
// isLocked: rawData.isLocked,
|
||||||
// isLocked: rawData.isLocked,
|
isAdult: rawData.adult,
|
||||||
isAdult: rawData.adult,
|
mostViewedAuthors: rawData.mostViewedAuthors.map(author => ({
|
||||||
mostViewedAuthors: rawData.mostViewedAuthors.map(author => ({
|
uid: author.user.uid,
|
||||||
uid: author.user.uid,
|
name: `${author.user.names[0].givenName} ${author.user.names[0].familyName}`,
|
||||||
name: `${author.user.names[0].givenName} ${author.user.names[0].familyName}`,
|
profile: quetrefy(author.user.profileUrl),
|
||||||
profile: quetrefy(author.user.profileUrl),
|
image: author.user.profileImageUrl,
|
||||||
image: author.user.profileImageUrl,
|
isAnon: author.user.isAnon,
|
||||||
isAnon: author.user.isAnon,
|
isVerified: author.user.isVerified,
|
||||||
isVerified: author.user.isVerified,
|
numFollowers: author.user.followerCount,
|
||||||
numFollowers: author.user.followerCount,
|
numViews: author.numViews,
|
||||||
numViews: author.numViews,
|
numAnswers: author.numPublicMostViewedAnswers,
|
||||||
numAnswers: author.numPublicMostViewedAnswers,
|
credential: author.user.bestCredential?.translatedString,
|
||||||
credential: author.user.bestCredential?.translatedString,
|
})),
|
||||||
})),
|
relatedTopics: rawData.relatedTopics.map(topic => ({
|
||||||
relatedTopics: rawData.relatedTopics.map(topic => ({
|
tid: topic.tid,
|
||||||
tid: topic.tid,
|
name: topic.name,
|
||||||
name: topic.name,
|
url: quetrefy(topic.url),
|
||||||
url: quetrefy(topic.url),
|
image: topic.photoUrl,
|
||||||
image: topic.photoUrl,
|
numFollowers: topic.numFollowers,
|
||||||
numFollowers: topic.numFollowers,
|
})),
|
||||||
})),
|
};
|
||||||
};
|
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -21,7 +21,6 @@ block content
|
||||||
span= data.aliases.join(', ')
|
span= data.aliases.join(', ')
|
||||||
.metadata-secondary
|
.metadata-secondary
|
||||||
+addMetadataSecondary('user','Followers', data.numFollowers)
|
+addMetadataSecondary('user','Followers', data.numFollowers)
|
||||||
+addMetadataSecondary('question','Questions', data.numQuestions)
|
|
||||||
if data.isAdult
|
if data.isAdult
|
||||||
+addMetadataSecondary('danger', 'Adult Topic', '18+', true)
|
+addMetadataSecondary('danger', 'Adult Topic', '18+', true)
|
||||||
+quorafyUrl(meta.url)(class='link')
|
+quorafyUrl(meta.url)(class='link')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue