Добавлен счётчик по работникам

This commit is contained in:
Pavel Gnedov 2025-02-07 19:10:14 +07:00
parent 04a0736c9a
commit 20b70c5799

View file

@ -229,8 +229,26 @@ export class DailyEccmV2ReportTaskRunnerService {
JSON.stringify(issuesByVersionsCount), JSON.stringify(issuesByVersionsCount),
); );
// ШАГ 3. Подсчет количества внутренних изменений // ШАГ 3. Подсчёт количества задач по работникам
this.logger.debug('Step 3. Calculating internal changes'); 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 = const changesInterval =
(widget?.dataLoaderParams['changesInterval'] as number) ?? (widget?.dataLoaderParams['changesInterval'] as number) ??
24 * 60 * 60 * 1000; 24 * 60 * 60 * 1000;
@ -300,12 +318,12 @@ export class DailyEccmV2ReportTaskRunnerService {
}); });
} }
this.logger.debug( this.logger.debug(
'Step 3. Calculating internal changes - done', 'Step 4. Calculating internal changes - done',
JSON.stringify(changesCount), JSON.stringify(changesCount),
); );
// ШАГ 4: Количество задач с оценками трудозатрат // ШАГ 5: Количество задач с оценками трудозатрат
this.logger.debug('Step 4. Counting issues with estimates and spent hours'); this.logger.debug('Step 5. Counting issues with estimates and spent hours');
const issuesWithEstimatesAndSpenthoursCount = { const issuesWithEstimatesAndSpenthoursCount = {
withEstimates: { count: 0, issueIds: [] }, withEstimates: { count: 0, issueIds: [] },
withoutEstimates: { count: 0, issueIds: [] }, withoutEstimates: { count: 0, issueIds: [] },
@ -402,12 +420,12 @@ export class DailyEccmV2ReportTaskRunnerService {
} }
}); });
this.logger.debug( 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), JSON.stringify(issuesWithEstimatesAndSpenthoursCount),
); );
// ШАГ 5: Счётчики сравнения с предыдущим отчётом // ШАГ 6: Счётчики сравнения с предыдущим отчётом
this.logger.debug('Step 5: Calculating differences with previous report'); this.logger.debug('Step 6: Calculating differences with previous report');
const differencesCount = { const differencesCount = {
newIssues: { count: 0, issueIds: [] }, newIssues: { count: 0, issueIds: [] },
lostIssues: { count: 0, issueIds: [] }, lostIssues: { count: 0, issueIds: [] },
@ -461,13 +479,14 @@ export class DailyEccmV2ReportTaskRunnerService {
} }
}); });
this.logger.debug( this.logger.debug(
'Step 5: Calculating differences with previous report - done', 'Step 6: Calculating differences with previous report - done',
JSON.stringify(differencesCount), JSON.stringify(differencesCount),
); );
const metrics = { const metrics = {
issuesByStatusCount: issuesByStatusCount, issuesByStatusCount: issuesByStatusCount,
issuesByVersionsCount: issuesByVersionsCount, issuesByVersionsCount: issuesByVersionsCount,
issuesByUsername: issuesByUsername,
changesCount: changesCount, changesCount: changesCount,
issuesWithEstimatesAndSpenthoursCount: issuesWithEstimatesAndSpenthoursCount:
issuesWithEstimatesAndSpenthoursCount, issuesWithEstimatesAndSpenthoursCount,