mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-25 22:19:28 -04:00
[pl][calendar] miastamaszerujace – extra precautions
This commit is contained in:
parent
2d6bf09cb0
commit
56a7c249f9
@ -40,7 +40,7 @@ const fetchEvents = async () => {
|
||||
|
||||
const dir = `${__dirname}/../static/calendar`;
|
||||
const path = `${dir}/miastamaszerujace-${year}.json`;
|
||||
const previous = fs.existsSync(path) ? JSON.parse(fs.readFileSync(path).toString('UTF-8')) : null;
|
||||
const previous = fs.existsSync(path) ? JSON.parse(fs.readFileSync(path).toString('UTF-8')) : [];
|
||||
if (JSON.stringify(events) !== JSON.stringify(previous)) {
|
||||
console.log('wykryto zmiany, wysyłam maila');
|
||||
mailer('andrea@pronouns.page', 'miastamaszerujace', {
|
||||
@ -49,6 +49,7 @@ const fetchEvents = async () => {
|
||||
maxwidth: '100%',
|
||||
})
|
||||
}
|
||||
if (previous.length > events.length) { return; }
|
||||
fs.writeFileSync(path, JSON.stringify(events, null, 4));
|
||||
|
||||
createEvents(
|
||||
|
Loading…
x
Reference in New Issue
Block a user