Skip to content

Commit

Permalink
🐛 Fix fetch of homeworks
Browse files Browse the repository at this point in the history
  • Loading branch information
Androz2091 committed Feb 18, 2021
1 parent aee3d74 commit 84a27cb
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const pronote = require("pronote-api");
const Discord = require("discord.js");
const client = new Discord.Client();

const DATE_END_OF_YEAR = new Date(Date.now() + 31536000000);

let cache = null;

/**
Expand Down Expand Up @@ -56,7 +54,7 @@ const pronoteSynchronization = async () => {
if (!session) return;

// Vérification des devoirs
const homeworks = await session.homeworks(Date.now(), DATE_END_OF_YEAR);
const homeworks = await session.homeworks(Date.now(), session.params.lastDay);
const newHomeworks = homeworks.filter((work) => !(cache.homeworks.some((cacheWork) => cacheWork.description === work.description)));
if (newHomeworks.length > 0 && newHomeworks.length <= 3) {
newHomeworks.forEach((work) => sendDiscordNotificationHomework(work));
Expand Down

0 comments on commit 84a27cb

Please sign in to comment.