Merge pull request #8701 from overleaf/bg-simple-iterable-paths

simple iterable paths

GitOrigin-RevId: f6906016888ccfc95c88858bdac4d2633fc1c5f4
This commit is contained in:
Brian Gough
2022-07-04 11:12:01 +01:00
committed by Copybot
parent be71ea690d
commit 5a3318f5b3
7 changed files with 53 additions and 15 deletions

View File

@@ -17,6 +17,7 @@ const ProjectLocator = require('./ProjectLocator')
const FolderStructureBuilder = require('./FolderStructureBuilder')
const SafePath = require('./SafePath')
const { DeletedFile } = require('../../models/DeletedFile')
const { iterablePaths } = require('./IterablePath')
const LOCK_NAMESPACE = 'mongoTransaction'
const ENTITY_TYPE_TO_MONGO_PATH_SEGMENT = {
@@ -494,7 +495,7 @@ function _countElements(project) {
let total = 0
if (folder.folders) {
total += folder.folders.length
for (const subfolder of folder.folders) {
for (const subfolder of iterablePaths(folder, 'folders')) {
total += countFolder(subfolder)
}
}