Skip to content

Commit

Permalink
update logic for initial retrievals
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesabarnes committed May 27, 2024
1 parent f97d860 commit 77badee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: docker/setup-buildx-action@v2

- name: Log in to GitHub Container Registry
run: echo "${{ secrets.GHCR_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin

- name: Build the Docker image
run: docker build . --file Dockerfile --tag ghcr.io/${{ github.repository_owner }}/my-image-name:latest
Expand Down
9 changes: 7 additions & 2 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ async function fetchUpcomingLeagueEvents(leagueId: string, notifyRoleId: string,
eventId: event.idEvent,
eventName: event.strEvent,
eventDate: gameDate,
notified: false,
leagueId,
notifyRoleId,
channelId: leagueChannelId,
Expand Down Expand Up @@ -153,7 +152,13 @@ async function checkDatabaseForNotifications() {
const tenMinutesFromNow = new Date((new Date()).getTime() + 600000);

try {
const games = await gamesCollection.find({ eventDate: { $gte: tenMinutesAgo, $lte: tenMinutesFromNow }, notified: false }).toArray();
const games = await gamesCollection.find({
eventDate: { $gte: tenMinutesAgo, $lte: tenMinutesFromNow },
$or: [
{ notified: { $exists: false } },
{ notified: false }
]
}).toArray();
for (const game of games) {
const channel = client.channels.cache.get(game.channelId!) as TextChannel;
if (channel) {
Expand Down

0 comments on commit 77badee

Please sign in to comment.