This commit is contained in:
bakhirev 2024-06-30 13:30:04 +03:00
parent d429a0cbf2
commit 0da4465981
7 changed files with 651 additions and 623 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

View file

@ -56,11 +56,8 @@ export default class DataGripByAuthor {
#addCommitByAuthor(commit: ICommit) {
const commitsByDayAndHour = DataGripByAuthor.getDefaultCommitsByDayAndHour();
try {
commitsByDayAndHour[commit.day][commit.hours] += 1;
} catch (e: any) {
debugger;
}
const commitsByHour = new Array(24).fill(0);
commitsByHour[commit.hours] += 1;

View file

@ -1,21 +1,51 @@
import ICommit, { COMMIT_TYPE, ISystemCommit } from 'ts/interfaces/Commit';
import IHashMap from 'ts/interfaces/HashMap';
import { getTypeAndScope, getTask, getTaskNumber } from './getTypeAndScope';
export default function getCommitInfo(logString: string): ICommit | ISystemCommit {
let prevDate = new Date();
export default function getCommitInfo(
logString: string,
refEmailAuthor: IHashMap<string>,
): ICommit | ISystemCommit {
// "2021-02-09T12:59:17+03:00>Frolov Ivan>frolov@mail.ru>profile"
const parts = logString.split('>');
const sourceDate = parts.shift() || '';
const date = new Date(sourceDate);
let date = new Date(sourceDate);
if (isNaN(date.getDay())) {
console.log(`PARSE ERROR: Date parse error for: "${logString}"`);
date = prevDate;
}
prevDate = date;
const day = date.getDay() - 1;
const timestamp = sourceDate.split('T')[0];
const author = parts.shift()?.replace(/[._]/gm, ' ') || '';
let author = parts.shift()?.replace(/[._]/gm, ' ') || '';
let email = parts.shift() || '';
if (!(/@/gim).test(email)) email = '';
const authorID = author.replace(/\s|\t/gm, '');
if (authorID && refEmailAuthor[authorID] && refEmailAuthor[authorID] !== author) {
console.log(`PARSE ERROR: Rename "${author}" to "${refEmailAuthor[authorID]}"`);
author = refEmailAuthor[authorID];
}
if (email && refEmailAuthor[email] && refEmailAuthor[email] !== author) {
console.log(`PARSE ERROR: Rename "${author}" to "${refEmailAuthor[email]}" by "${email}"`);
author = refEmailAuthor[email];
}
if (author && refEmailAuthor[author] && refEmailAuthor[author] !== email) {
console.log(`PARSE ERROR: Rename "${email}" to "${refEmailAuthor[author]}" by "${author}"`);
email = refEmailAuthor[author];
}
refEmailAuthor[email] = author;
refEmailAuthor[author] = email;
refEmailAuthor[authorID] = author;
const message = parts.join('>');
const commonInfo: any = {

View file

@ -16,6 +16,7 @@ export default function Parser(report: string[]) {
let commit = null;
const commits: Array<ICommit | ISystemCommit> = [];
let refEmailAuthor: IHashMap<string> = {};
let files: IHashMap<IFileChange> = {};
let fileChanges: IFileChange | null = null;
@ -54,7 +55,7 @@ export default function Parser(report: string[]) {
// "2021-02-09T16:08:15+03:00>Albert>instein@mail.de>feat(init): added the speed of light"
if (commit) commit.fileChanges = Object.values(files);
files = {};
commit = getCommitInfo(message);
commit = getCommitInfo(message, refEmailAuthor);
const monday = commit.milliseconds - commit.day * ONE_DAY;
if (firstMonday) {

View file

@ -25,7 +25,7 @@ export default {
lessScopes: ACHIEVEMENT_TYPE.BAD, // Щегол
moreDaysForTask: ACHIEVEMENT_TYPE.BAD, // Улитка на склоне
more2DaysForTask: ACHIEVEMENT_TYPE.BAD, // Cо слоу
moreDaysInProject: ACHIEVEMENT_TYPE.GOOD, // Часть команды, часть коробля
moreDaysInProject: ACHIEVEMENT_TYPE.GOOD, // Часть команды, часть корабля
lessDaysInProject: ACHIEVEMENT_TYPE.NORMAL, // А это кто?
more90DaysInProject: ACHIEVEMENT_TYPE.GOOD, // Добро пожаловать
lessDaysForTask: ACHIEVEMENT_TYPE.GOOD, // Скорострел

View file

@ -61,7 +61,7 @@ export default `
§ achievements.more666DaysInProject.description: отработал 666 дней на проекте
§ achievements.more777DaysInProject.title: Азино 3 топора
§ achievements.more777DaysInProject.description: отработал 777 дней на проекте
§ achievements.moreDaysInProject.title: Часть команды, часть коробля
§ achievements.moreDaysInProject.title: Часть команды, часть корабля
§ achievements.moreDaysInProject.description: больше всего дней на проекте
§ achievements.moreRefactoring.title: Выпускающий редактор
§ achievements.moreRefactoring.description: сделал больше всех меток «рефакторинг»