From 54483b96b6e78b0f881f324bede7637e62c5c10b Mon Sep 17 00:00:00 2001 From: Kfir Dayan Date: Tue, 23 Jan 2024 11:53:52 +0200 Subject: [PATCH] adding logs outputs of handeling events --- dist/index.js | 6 ++---- src/index.ts | 7 ++----- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/dist/index.js b/dist/index.js index c139836..17fefd1 100644 --- a/dist/index.js +++ b/dist/index.js @@ -16,11 +16,11 @@ class App { console.log("START CRON JOB"); const newGamesAdded = []; await this.googleCalendar.init(); - // Schedule the job to run daily at a specific time (e.g., 1:00 AM) try { const games = await app.gameSource.getGamesFromHaifa(); for (const game of games) { const isDuplicateEvent = await this.googleCalendar.isDuplicateEvent(game.start.dateTime, game.end.dateTime, game.summary); + console.log(game); if (!isDuplicateEvent) { newGamesAdded.push(game); console.log("Event does not exist"); @@ -28,15 +28,13 @@ class App { } else { console.log("Event already exists"); - console.log("Event:"); - console.log("Happening at:"); } } if (newGamesAdded.length > 0) { console.log("New games added:", newGamesAdded); } else { - console.log("No new games added"); + console.log("No new games was Added!"); } } catch (error) { diff --git a/src/index.ts b/src/index.ts index 484c2ce..d22b81c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,7 +18,6 @@ class App { console.log("START CRON JOB"); const newGamesAdded = []; await this.googleCalendar.init(); - // Schedule the job to run daily at a specific time (e.g., 1:00 AM) try { const games = await app.gameSource.getGamesFromHaifa(); @@ -28,22 +27,20 @@ class App { game.end.dateTime, game.summary ); - + console.log(game) if (!isDuplicateEvent) { newGamesAdded.push(game); console.log("Event does not exist"); await this.googleCalendar.updateNewEvent([game]); } else { console.log("Event already exists"); - console.log("Event:"); - console.log("Happening at:"); } } if(newGamesAdded.length > 0) { console.log("New games added:", newGamesAdded); } else { - console.log("No new games added"); + console.log("No new games was Added!"); } } catch (error) { console.error("Error in cron job:", error.message);