derekantrican / GAS-ICS-Sync

A Google Apps Script for syncing ICS/ICAL files faster than the current Google Calendar speed
GNU General Public License v3.0
1.51k stars 191 forks source link

"Parsed 0 events from ical sources" from Moodle Calendar URL export #177

Closed hambergerpls closed 4 months ago

hambergerpls commented 3 years ago

Hi, I'm trying to import a Moodle calendar URL link into the script but it did not fetch any events from the url

URL: https://smartv3.ums.edu.my/calendar/export_execute.php?userid=50129&authtoken=3240f8f614fb86a8445eda299e87fd6a85ca5afd&preset_what=all&preset_time=recentupcoming

Log:

Jan 2, 2021, 3:41:55 PM Info    Result: 1
Jan 2, 2021, 3:41:55 PM Info    Syncing 1 calendars to SmartUMS
Jan 2, 2021, 3:41:55 PM Info    Working on calendar: 87vnh6usj4ligkvodknot3suio@group.calendar.google.com
Jan 2, 2021, 3:41:55 PM Info    Fetched 0 existing events from SmartUMS
Jan 2, 2021, 3:41:55 PM Info    Parsed 0 events from ical sources
Jan 2, 2021, 3:41:55 PM Info    Processing 0 events
Jan 2, 2021, 3:41:55 PM Info    Done processing events
Jan 2, 2021, 3:41:55 PM Info    Checking 0 events for removal
Jan 2, 2021, 3:41:55 PM Info    Done checking events for removal
Jan 2, 2021, 3:41:55 PM Info    Processing 0 Recurrence Instances!
Jan 2, 2021, 3:41:55 PM Info    Sync finished!

When I input the URL in the browser, it downloads the .ics file and I'm able to import it to Google Calendars with the events, but when I use the URL directly in Calendar, it couldn't find any events. I also noticed that the URL is not in iCal format, so I'm not sure if that is the cause.

jonas0b1011001 commented 3 years ago

The URL returns an empty calendar. Does it require some additional type of authentication?

hambergerpls commented 3 years ago

I don't think it requires any additional authentication since the link downloads the icalexport.ics file if I try the link in incognito but it didn't work when I import through URL in Google Calendar and GAS.

The body response I got from postman is this:

BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//John Papaioannou/NONSGML Bennu 0.1//EN
VERSION:2.0
END:VCALENDAR
derekantrican commented 3 years ago

So it looks like the ICS is being returned, but is empty. I would expect an auth issue would mean you get nothing back. Maybe something isn't set up properly for publishing in Moodle? Or maybe there's no events that match the "filters" you have in the URL (preset_what=all&preset_time=recentupcoming)?

I also noticed that the URL is not in iCal format

Likely not an issue - a URL doesn't have to end in ".ics" or ".ical" to be a valid calendar.

the link downloads the icalexport.ics file if I try the link in incognito

Are you willing to share this?

derekantrican commented 3 years ago

I see this, are you referencing those directions? https://docs.moodle.org/310/en/Using_Calendar#Dynamic_Link_to_Moodle_Calendar

hambergerpls commented 3 years ago

I see this, are you referencing those directions? https://docs.moodle.org/310/en/Using_Calendar#Dynamic_Link_to_Moodle_Calendar

Yes

So it looks like the ICS is being returned, but is empty. I would expect an auth issue would mean you get nothing back. Maybe something isn't set up properly for publishing in Moodle? Or maybe there's no events that match the "filters" you have in the URL (preset_what=all&preset_time=recentupcoming)?

I also noticed that the URL is not in iCal format

Likely not an issue - a URL doesn't have to end in ".ics" or ".ical" to be a valid calendar.

the link downloads the icalexport.ics file if I try the link in incognito

Are you willing to share this?

Okay I felt silly for not being thorough. I didn't realise that there were a size difference in ics file when I try in incognito and when I try it while logged into my Moodle. It does require an authentication to get the events

Here's the result icalexport.ics (While logged in)

BEGIN:VCALENDAR
METHOD:PUBLISH
PRODID:-//John Papaioannou/NONSGML Bennu 0.1//EN
VERSION:2.0
BEGIN:VEVENT
UID:63297@smartv3.ums.edu.my
SUMMARY:WEEK 11: Designing mobile apps &amp\; web should be completed
DESCRIPTION:Week 11 class will be conducted through async mode. Students ar
    e required to watch the lecture using the provided link. \n\n

CLASS:PUBLIC
LAST-MODIFIED:20201228T000947Z
DTSTAMP:20210103T014714Z
DTSTART:20210101T160000Z
DTEND:20210101T160000Z
CATEGORIES:KP34703 [1-2020/2021]
END:VEVENT
BEGIN:VEVENT
UID:63311@smartv3.ums.edu.my
SUMMARY:WEEK 11: Group Activity Submission - async mode
DESCRIPTION:Each GROUP is required to audit their SmartHome apps design usi
    ng the 25 principles proposed by Google Team (only 6 principles has been ex
    plained in the video).\n\nProvide a special checklist report consist of the
     evaluation of your SmartHome apps. \n

... (TRIMMED)

CLASS:PUBLIC
LAST-MODIFIED:20201230T235250Z
DTSTAMP:20210103T014714Z
DTSTART:20210115T155500Z
DTEND:20210115T155500Z
CATEGORIES:KP00703 [1-2020/2021]
END:VEVENT
END:VCALENDAR
derekantrican commented 3 years ago

Ok, may be related to #157? I might contact you later to test out that feature

jonas0b1011001 commented 3 years ago

I did a quick test on the Moodle Demo Page and the export link created on there seems to work fine regardless of incognito mode on/off.

As this does not look like a general Moodle problem maybe the admins of your uni's webpage can help you out with this one.

ProgramComputer commented 3 years ago

I think this can help with this issue.