Skip to content

Commit

Permalink
Меняет вывод советов/ответов на странице автора (#1192)
Browse files Browse the repository at this point in the history
  • Loading branch information
igsekor authored Aug 18, 2023
1 parent 8ab30c9 commit 6939efc
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/views/person.11tydata.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,25 @@ module.exports = {
},

isOnlyWithPractice: function (data) {
const { personId, docsByPerson } = data
return !docsByPerson[personId]
const { personId, practicesByPerson, docsByPerson } = data
if (docsByPerson[personId] && practicesByPerson[personId]) {
const docsCategories = Object.keys(docsByPerson[personId])
const answersCategories = Object.keys(practicesByPerson[personId])
return !!answersCategories.filter((a) => !docsCategories.includes(a)).length
} else {
return !docsByPerson[personId] && !!practicesByPerson[personId]
}
},

isOnlyWithAnswer: function (data) {
const { personId, docsByPerson } = data
return !docsByPerson[personId]
const { personId, answersByPerson, docsByPerson } = data
if (docsByPerson[personId] && answersByPerson[personId]) {
const docsCategories = Object.keys(docsByPerson[personId])
const answersCategories = Object.keys(answersByPerson[personId])
return !!answersCategories.filter((a) => !docsCategories.includes(a)).length
} else {
return !docsByPerson[personId] && !!answersByPerson[personId]
}
},

articlesIndex: function (data) {
Expand Down

0 comments on commit 6939efc

Please sign in to comment.