Skip to content
This repository has been archived by the owner on Dec 7, 2023. It is now read-only.

Automatically populate a team vacation calendar #114

Open
LLCheong opened this issue Mar 9, 2020 · 4 comments
Open

Automatically populate a team vacation calendar #114

LLCheong opened this issue Mar 9, 2020 · 4 comments

Comments

@LLCheong
Copy link

LLCheong commented Mar 9, 2020

I tried the above script but it seems that it didn't work correctly. I ran the script in November 2019, it only updated the events of the team till February 2020 which was set in the script (3 months' advance). Events that were updated in team members' calendars after February 2020 no longer sync. This was strange since in the script the sync frequency was set to be every hour.

Besides the above mentioned, in the team there are total 6 members. Out of 6 members, only 4 members' calendars were shown after the first run of the script. All members' calendars were shared.

Any clue what will be caused for all the mentioned?

Thanks

@hstaab87
Copy link

I am also having issues, similar to LLCheong. Only some of the team members's calendars sync. I have tried multiple calendars, scripts, different user groups. I'm unable to identify the issue.

@dennyhollick
Copy link

dennyhollick commented Mar 19, 2021

There appears to be issues with the shouldImportEvent function.

function shoudImportEvent(user, keyword, event) {
  // Filter out events where the keyword did not appear in the summary
  // (that is, the keyword appeared in a different field, and are thus
  // is not likely to be relevant).
  if (event.summary.toLowerCase().indexOf(keyword)) < 0) {
    return false;
  }

This indexOf will not match because if the the keyword also needs to be in lowercase. To fix this I changed it to:

  // Filter out events where the keyword did not appear in the summary
  // (that is, the keyword appeared in a different field, and are thus
  // is not likely to be relevant).
  if (event.summary.toLowerCase().indexOf(keyword.toLowerCase()) < 0) {
    return false;
  }

The main change is adding .toLowerCase() to keyword.

And started seeing matches/imports. For some reason though, the console.log says 0 imported, when it actually did import, so I'll try debug that next maybe...

@jc00ke
Copy link

jc00ke commented Aug 11, 2021

I have this working now after changing the shouldImportEvent function to specifically look for OOO events. I think this is a more correct and robust way of managing the calendar. https://gist.github.com/jc00ke/5b77c0fe7f6435061c37005731556b58

@simaoafonso-pwt
Copy link

See #209

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants