Skip to content

Commit db1a6fc

Browse files
committed
update
1 parent b931660 commit db1a6fc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

components/intercom/sources/new-conversation-rating-added/new-conversation-rating-added.mjs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ export default {
2929
},
3030
},
3131
async run() {
32-
let lastRatingCreatedAt = this._getLastUpdate();
32+
const lastRatingCreatedAt = this._getLastUpdate();
33+
let maxLastRatingCreatedAt = lastRatingCreatedAt;
3334
const data = {
3435
query: {
3536
field: "conversation_rating.requested_at",
@@ -41,14 +42,14 @@ export default {
4142
const results = await this.intercom.searchConversations(data);
4243
for (const conversation of results) {
4344
const createdAt = conversation.conversation_rating.created_at;
44-
if (createdAt > lastRatingCreatedAt)
45-
lastRatingCreatedAt = createdAt;
45+
if (createdAt > maxLastRatingCreatedAt)
46+
maxLastRatingCreatedAt = createdAt;
4647
if (!this.newConversationsOnly || conversation.created_at > lastRatingCreatedAt) {
4748
const meta = this.generateMeta(conversation);
4849
this.$emit(conversation, meta);
4950
}
5051
}
5152

52-
this._setLastUpdate(lastRatingCreatedAt);
53+
this._setLastUpdate(maxLastRatingCreatedAt);
5354
},
5455
};

0 commit comments

Comments
 (0)