From eb2976ad4730e880f0964cd61084fb8198a5303f Mon Sep 17 00:00:00 2001 From: Gnedov Pavel Date: Wed, 9 Nov 2022 13:52:05 +0700 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D1=8B=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BA=D0=B8=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D0=BE=D0=B3=D1=80=D0=B0=D0=BD=D0=B8=D1=87?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D1=83=D1=81=D0=BB=D0=BE=D0=B2=D0=B8=D1=8F?= =?UTF-8?q?=D1=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/event-emitter/src/users/users.service.ts | 2 +- src/reports/daily-eccm.report.service.ts | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/event-emitter/src/users/users.service.ts b/libs/event-emitter/src/users/users.service.ts index cdc34b7..a4c7667 100644 --- a/libs/event-emitter/src/users/users.service.ts +++ b/libs/event-emitter/src/users/users.service.ts @@ -64,7 +64,7 @@ export class UsersService { }, limit: 1, }); - if (!res && !res.docs && !res.docs[0]) { + if (!res || !res.docs || !res.docs[0]) { return null; } const userFromDb = res.docs[0]; diff --git a/src/reports/daily-eccm.report.service.ts b/src/reports/daily-eccm.report.service.ts index 0c5315a..f249cd8 100644 --- a/src/reports/daily-eccm.report.service.ts +++ b/src/reports/daily-eccm.report.service.ts @@ -141,6 +141,10 @@ export namespace DailyEccmReport { private issuesService: IssuesService, ) { const users: Models.UserReport[] = this.eccmUsers.map((user) => { + if (!user) { + this.logger.error(`Not found user data`); + return; + } const u: Models.User = { id: user.id, lastname: user.lastname, @@ -151,7 +155,7 @@ export namespace DailyEccmReport { activities: [], issuesGroupedByStatus: [], } as Models.UserReport; - }); + }).filter((user) => Boolean(user)); this.report = { byUsers: users, params: { @@ -456,6 +460,9 @@ export class DailyEccmReportService { this.logger.debug(`Loaded data for uniq issues - count = ${issues.length}`); const issuesMap: Record = {}; issues.forEach((issue) => { + if (!issue || !issue.fixed_version) { + return; + } const version = issue.fixed_version.name; if (this.eccmConfig.currentVersions.includes(version)) { issuesMap[issue.id] = issue;