yohei0125 4 лет назад
Родитель
Сommit
bc2659961b
2 измененных файлов с 3 добавлено и 3 удалено
  1. 2 2
      packages/app/src/server/models/page.ts
  2. 1 1
      packages/app/src/server/service/page.ts

+ 2 - 2
packages/app/src/server/models/page.ts

@@ -462,7 +462,7 @@ schema.statics.incrementDescendantCountOfPageIds = async function(pageIds: Objec
 /**
  * recount descendantCount of a page with the provided id and return it
  */
-schema.statics.recountSelfDescendantCount = async function(id: ObjectIdLike):Promise<number> {
+schema.statics.recountDescendantCount = async function(id: ObjectIdLike):Promise<number> {
   const res = await this.aggregate(
     [
       {
@@ -594,7 +594,7 @@ export default (crowi: Crowi): any => {
     let page;
     if (emptyPage != null) {
       page = emptyPage;
-      const descendantCount = await this.recountSelfDescendantCount(page._id);
+      const descendantCount = await this.recountDescendantCount(page._id);
 
       page.descendantCount = descendantCount;
       page.isEmpty = false;

+ 1 - 1
packages/app/src/server/service/page.ts

@@ -2168,7 +2168,7 @@ class PageService {
       objectMode: true,
       async write(pageDocuments, encoding, callback) {
         for await (const document of pageDocuments) {
-          const descendantCount = await Page.recountSelfDescendantCount(document._id);
+          const descendantCount = await Page.recountDescendantCount(document._id);
           await Page.findByIdAndUpdate(document._id, { descendantCount });
         }
         callback();