Skip to content

Commit

Permalink
TMP: DEBUG: Grab 2 weeks of messages, not just yesterday
Browse files Browse the repository at this point in the history
  • Loading branch information
nmagedman committed Jan 23, 2025
1 parent 3b7ad77 commit f44f00f
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -97,7 +97,7 @@ function buildMongoMatchDoc(searchPattern, date) {
return {
ts: {
$gte: date,
$lt: theDayAfter(date),
$lt: theDayAfter(today()),
},
msg: RegExp(searchPattern, 'i'),
};
Expand Down

0 comments on commit f44f00f

Please sign in to comment.