Merge pull request #2378 from harrellbm/develop

First working docs stats
This commit is contained in:
Luis Fernando Molina authored and GitHub committed 2021-10-31 05:48:12 -04:00
commit 513e9aac18
1 file changed
+26 -1
@@ -9,6 +9,31 @@ function newEducationFunctionLibraryDocsStats() {
node,
rootNodes
) {
console.log("this is our docs stats")
console.log("Docs Statistical Report:")
let documentPage
let pagesCount = 0
let projectStats = {}
// Create Stats for each project
for (let j = 0; j < PROJECTS_SCHEMA.length; j++) {
let project = PROJECTS_SCHEMA[j].name
projectStats[project] = 0
}
for (let i = 0; i < UI.projects.education.spaces.docsSpace.searchEngine.docsIndex.length; i++) {
documentPage = UI.projects.education.spaces.docsSpace.searchEngine.docsIndex[i]
pagesCount += 1
if (projectStats[documentPage.project] !== undefined) {
lastValue = projectStats[documentPage.project]
}
projectStats[documentPage.project] = lastValue + 1
//will need to access documentPage.docsSchemaDocument.paragraphs then for each paragraph paragraph.translations
}
console.log("We have this many pages " + pagesCount + " total across all projects.")
for (let project in projectStats) {
console.log(`There are this many pages ${projectStats[project]} in the ${project} project`)
}
}
}