adding logs outputs of handeling events
This commit is contained in:
parent
522d30d7dd
commit
54483b96b6
2 changed files with 4 additions and 9 deletions
6
dist/index.js
vendored
6
dist/index.js
vendored
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue