From d43cc54f56118cb90a383b5651e8c5f25383e4a9 Mon Sep 17 00:00:00 2001 From: Pavel Gnedov Date: Tue, 7 Nov 2023 02:33: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=BB=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/issue-enhancers/calendar-enhancer.ts | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/libs/event-emitter/src/issue-enhancers/calendar-enhancer.ts b/libs/event-emitter/src/issue-enhancers/calendar-enhancer.ts index 92dfc8c..c222a9b 100644 --- a/libs/event-emitter/src/issue-enhancers/calendar-enhancer.ts +++ b/libs/event-emitter/src/issue-enhancers/calendar-enhancer.ts @@ -24,7 +24,7 @@ export const UNKNOWN_CALENDAR_EVENT = 'Unknown calendar event'; @Injectable() export class CalendarEnhancer implements IssueEnhancerInterface { private logger = new Logger(CalendarEnhancer.name); - + name = 'calendar'; constructor( @@ -33,8 +33,15 @@ export class CalendarEnhancer implements IssueEnhancerInterface { public descriptionCalendarParams: DescriptionParserParams, public calendarEventsKey: string, ) { - const initParams = {useForProjects, customFields, descriptionCalendarParams, calendarEventsKey}; - this.logger.debug(`Calendar enhancer init with ${JSON.stringify(initParams)}`); + const initParams = { + useForProjects, + customFields, + descriptionCalendarParams, + calendarEventsKey, + }; + this.logger.debug( + `Calendar enhancer init with ${JSON.stringify(initParams)}`, + ); } async enhance( @@ -49,10 +56,18 @@ export class CalendarEnhancer implements IssueEnhancerInterface { try { res[this.calendarEventsKey] = this.getCalendarEvents(res); } catch (ex) { - this.logger.error(`Error at parsing calendar events, message - ${ex}: ${(ex as Error)?.stack}`); + this.logger.error( + `Error at parsing calendar events, message - ${ex}: ${ + (ex as Error)?.stack + }`, + ); return res; } - this.logger.debug(`Calendar events for #${issue.id}: issue.${this.calendarEventsKey} = ${JSON.stringify(res[this.calendarEventsKey])}`); + this.logger.debug( + `Calendar events for #${issue.id}: issue.${ + this.calendarEventsKey + } = ${JSON.stringify(res[this.calendarEventsKey])}`, + ); return res; } @@ -147,7 +162,9 @@ export class CalendarEnhancer implements IssueEnhancerInterface { const lines = text.split('\n').map((line) => line.trim()); - const calendarStartIndex = lines.indexOf(this.descriptionCalendarParams.title); + const calendarStartIndex = lines.indexOf( + this.descriptionCalendarParams.title, + ); if (calendarStartIndex < 0) return []; let index = calendarStartIndex + 1;