From f44f00fdcad9a8083f194cf248b9b37400b5d185 Mon Sep 17 00:00:00 2001 From: Noach Magedman Date: Thu, 23 Jan 2025 18:52:58 +0200 Subject: [PATCH] TMP: DEBUG: Grab 2 weeks of messages, not just yesterday --- .../app/seeking-alpha/terms-of-use-violations/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts b/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts index 1a1c4ef5649c..1e15e1aee2d9 100644 --- a/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts +++ b/apps/meteor/app/seeking-alpha/terms-of-use-violations/index.ts @@ -11,7 +11,7 @@ import { readSecondaryPreferred } from '../../../server/database/readSecondaryPr import { settings } from '../../settings/server'; import Slack from '../utils/Slack'; import { generateCSV } from '../utils/csv'; -import { yesterday, theDayAfter } from '../utils/datetime_functions'; +import { yesterday, theDayAfter, today, nDaysBeforeDate } from '../utils/datetime_functions'; const CRON_JOB_NAME = 'seeking-alpha-terms-of-use-violations'; @@ -53,7 +53,7 @@ async function perform() { const attachments = []; const promises = TERMS_TO_MONITOR.map( - keyword => aggregateMessagesContainingKeyword(keyword, yesterday()) + keyword => aggregateMessagesContainingKeyword(keyword, nDaysBeforeDate(14, today())) ); const aggregations = await Promise.all(promises); @@ -97,7 +97,7 @@ function buildMongoMatchDoc(searchPattern, date) { return { ts: { $gte: date, - $lt: theDayAfter(date), + $lt: theDayAfter(today()), }, msg: RegExp(searchPattern, 'i'), };