From c6065d094a9f68ffb4f81d53e29f2e01d7a7539c Mon Sep 17 00:00:00 2001
From: Andrey Sobolev <haiodo@users.noreply.github.com>
Date: Wed, 4 Oct 2023 12:57:24 +0700
Subject: [PATCH] QFIX: Child info could be empty (#3785)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
---
 models/tracker/src/migration.ts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/models/tracker/src/migration.ts b/models/tracker/src/migration.ts
index faed6df9fb..e35350d74e 100644
--- a/models/tracker/src/migration.ts
+++ b/models/tracker/src/migration.ts
@@ -103,7 +103,7 @@ async function fixSpentTime (client: MigrationClient): Promise<void> {
   const issues = await client.find<Issue>(DOMAIN_TASK, { reportedTime: { $gt: 0 } })
   for (const issue of issues) {
     const childInfo = issue.childInfo
-    for (const child of childInfo) {
+    for (const child of childInfo ?? []) {
       child.reportedTime = child.reportedTime * 8
     }
     await client.update(DOMAIN_TASK, { _id: issue._id }, { reportedTime: issue.reportedTime * 8, childInfo })