Skip to content

Commit

Permalink
fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo committed Aug 2, 2024
1 parent 5cd073d commit 7108f91
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions apps/meteor/server/models/raw/LivechatRooms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
}

private getAnalyticsUpdateQuery(
analyticsData: Record<string, string | number | Date>,
analyticsData: Record<string, string | number | Date> | undefined,
updater: Updater<IOmnichannelRoom> = this.getUpdater(),
) {
if (analyticsData) {
Expand All @@ -2032,7 +2032,7 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
updater.inc('metrics.reaction.tt', analyticsData.reactionTime as number);
}

if (analyticsData.firstResponseTime) {
if (analyticsData?.firstResponseTime) {
updater.set('metrics.reaction.fd', analyticsData.firstReactionDate);
updater.set('metrics.reaction.ft', analyticsData.firstReactionTime);
updater.set('metrics.response.fd', analyticsData.firstResponseDate);
Expand All @@ -2045,7 +2045,7 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
private getAnalyticsUpdateQueryBySentByAgent(
room: IOmnichannelRoom,
message: IMessage,
analyticsData: Record<string, string | number | Date>,
analyticsData: Record<string, string | number | Date> | undefined,
) {
const updater = this.getAnalyticsUpdateQuery(analyticsData);

Expand All @@ -2063,7 +2063,7 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
private getAnalyticsUpdateQueryBySentByVisitor(
room: IOmnichannelRoom,
message: IMessage,
analyticsData: Record<string, string | number | Date>,
analyticsData: Record<string, string | number | Date> | undefined,
) {
const updater = this.getAnalyticsUpdateQuery(analyticsData);

Expand All @@ -2082,7 +2082,7 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
private getAnalyticsUpdateQueryByRoomId(
room: IOmnichannelRoom,
message: IMessage,
analyticsData: Record<string, string | number | Date>,
analyticsData: Record<string, string | number | Date> | undefined,
) {
return isMessageFromVisitor(message)
? this.getAnalyticsUpdateQueryBySentByVisitor(room, message, analyticsData)
Expand All @@ -2092,7 +2092,7 @@ export class LivechatRoomsRaw extends BaseRaw<IOmnichannelRoom> implements ILive
async saveAnalyticsDataByRoomId(
room: IOmnichannelRoom,
message: IMessage,
analyticsData: Record<string, string | number | Date>,
analyticsData?: Record<string, string | number | Date>,
): Promise<void> {
const updater = this.getAnalyticsUpdateQueryByRoomId(room, message, analyticsData);
return updater.persist({ _id: room._id });
Expand Down

0 comments on commit 7108f91

Please sign in to comment.