From 20b70c5799155480c7c1e0375fefa05a36bbbc7b Mon Sep 17 00:00:00 2001 From: Pavel Gnedov Date: Fri, 7 Feb 2025 19:10:14 +0700 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=20=D1=81=D1=87=D1=91=D1=82=D1=87=D0=B8=D0=BA=20=D0=BF?= =?UTF-8?q?=D0=BE=20=D1=80=D0=B0=D0=B1=D0=BE=D1=82=D0=BD=D0=B8=D0=BA=D0=B0?= =?UTF-8?q?=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...aily-eccm-v2-report-task-runner.service.ts | 37 ++++++++++++++----- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/src/reports/daily-eccm-v2-report-task-runner.service.ts b/src/reports/daily-eccm-v2-report-task-runner.service.ts index 0a9b108..7cf9383 100644 --- a/src/reports/daily-eccm-v2-report-task-runner.service.ts +++ b/src/reports/daily-eccm-v2-report-task-runner.service.ts @@ -229,8 +229,26 @@ export class DailyEccmV2ReportTaskRunnerService { JSON.stringify(issuesByVersionsCount), ); - // ШАГ 3. Подсчет количества внутренних изменений - this.logger.debug('Step 3. Calculating internal changes'); + // ШАГ 3. Подсчёт количества задач по работникам + this.logger.debug('Step 3. Calculating issues by user names'); + const issuesByUsername = {}; + issues.forEach((issue: any) => { + const currentUser = issue.current_user?.name; + if (currentUser) { + if (!issuesByUsername[currentUser]) { + issuesByUsername[currentUser] = { count: 0, issueIds: [] }; + } + issuesByUsername[currentUser].count += 1; + issuesByUsername[currentUser].issueIds.push(issue.id); + } + }); + this.logger.debug( + 'Step 3. Calculating issues by user names - done', + JSON.stringify(issuesByUsername), + ); + + // ШАГ 4. Подсчет количества внутренних изменений + this.logger.debug('Step 4. Calculating internal changes'); const changesInterval = (widget?.dataLoaderParams['changesInterval'] as number) ?? 24 * 60 * 60 * 1000; @@ -300,12 +318,12 @@ export class DailyEccmV2ReportTaskRunnerService { }); } this.logger.debug( - 'Step 3. Calculating internal changes - done', + 'Step 4. Calculating internal changes - done', JSON.stringify(changesCount), ); - // ШАГ 4: Количество задач с оценками трудозатрат - this.logger.debug('Step 4. Counting issues with estimates and spent hours'); + // ШАГ 5: Количество задач с оценками трудозатрат + this.logger.debug('Step 5. Counting issues with estimates and spent hours'); const issuesWithEstimatesAndSpenthoursCount = { withEstimates: { count: 0, issueIds: [] }, withoutEstimates: { count: 0, issueIds: [] }, @@ -402,12 +420,12 @@ export class DailyEccmV2ReportTaskRunnerService { } }); this.logger.debug( - 'Step 4. Counting issues with estimates and spent hours - done', + 'Step 5. Counting issues with estimates and spent hours - done', JSON.stringify(issuesWithEstimatesAndSpenthoursCount), ); - // ШАГ 5: Счётчики сравнения с предыдущим отчётом - this.logger.debug('Step 5: Calculating differences with previous report'); + // ШАГ 6: Счётчики сравнения с предыдущим отчётом + this.logger.debug('Step 6: Calculating differences with previous report'); const differencesCount = { newIssues: { count: 0, issueIds: [] }, lostIssues: { count: 0, issueIds: [] }, @@ -461,13 +479,14 @@ export class DailyEccmV2ReportTaskRunnerService { } }); this.logger.debug( - 'Step 5: Calculating differences with previous report - done', + 'Step 6: Calculating differences with previous report - done', JSON.stringify(differencesCount), ); const metrics = { issuesByStatusCount: issuesByStatusCount, issuesByVersionsCount: issuesByVersionsCount, + issuesByUsername: issuesByUsername, changesCount: changesCount, issuesWithEstimatesAndSpenthoursCount: issuesWithEstimatesAndSpenthoursCount,