msramalho / SigTools

📆 Sigarra Tools | An extension that makes the information system of the University of Porto slightly better.
https://chrome.google.com/webstore/detail/sigarra-to-calendar/piefgbacnljenipiifjopkfifeljjkme
Apache License 2.0
37 stars 0 forks source link

ICS events show as 'free' in calendar clients #113

Closed fabiodrg closed 2 years ago

fabiodrg commented 2 years ago

All events generated via ics.js show as 'Free' in calendar clients and I think it is quite correct. It could be a configurable option of course, but I think by default all events associated to timetables and exams should appear as 'Busy'. A bill deadline is more a reminder, thus that should be fine to show as 'Free' (in my opinion). I guess it would be nice to tweak the default per extractor-basis and let the user customise if he needs to.

After reading the standard and inspecting the code, the problem is the lib adding a TRANSP field on VEVENT: https://github.com/nwcell/ics.js/blob/dfec67f37a3c267b3f97dd229c9b6a3521222794/ics.js#L187.

Time Transparency is the characteristic of an event that determines whether it appears to consume time on a calendar. Events that consume actual time for the individual or resource associated with the calendar SHOULD be recorded as OPAQUE, allowing them to be detected by free/busy time searches. Other events, which do not take up the individual's (or resource's) time SHOULD be recorded as TRANSPARENT, making them invisible to free/ busy time searches. - https://icalendar.org/iCalendar-RFC-5545/3-8-2-7-time-transparency.html

I guess we cannot easily override this behaviour... The lib is no longer maintained either. Should we fork it? Consider using another lib?

fabiodrg commented 2 years ago

Nvm. We have the lib locally within the project. I think it is fine to to extend the addEvent to support a status that is either 'BUSY' or 'FREE' and set the 'TRANSP' accordingly.

One additional idea. Add a addSigEvent in ics.js that supports the new CalEvent class?

fabiodrg commented 2 years ago

One more thing. The ics.js lib is setting the events class as public. This parameter is optional and I think we should remove it. When the events are imported to a calender service, if CLASS is omitted, then the default for that event is used, which resembles the behaviour of going to Google Calendar and add an event manually.