Open aaaaargZombies opened 2 years ago
The problem is that you can't tell if a calendar will import successfully without importing the calendar. The best you can hope for is to put together some heuristics that try to make a best guess. You may suggest that we could do the import in request immediately upon calendar save but they can take a very long time which is why they are background jobs.
So there are no easy solutions.
I would suggest finding a way to better explain to a user the process/state of a calendar
This can be done but it's a bit of javascript:
Came up today after a calendar took ages to show up - i think the new longer cron period is exacerbating this
Okay so a solution may be to make the calendar importer more modular with two parts:
All the code that tries to read a remote URL, fetch and parse the event data into a common format is here, it has no notion of any of the rails stuff- so no "calendar" object, no partners and no tags or anything like that. Just takes a URL and returns a payload with something like
{
"importer_wanted": "",
"importer_used": "ical",
"events": [ ]
}
This can then be exposed in a (very private) API endpoint that just takes a URL and returns the JSON in an ajax type thing.
Wraps the thing above and does all the nasty rails stuff
It will be a lot faster as a lot of the calendar importers' time is taken up with database stuff (especially that weird versioning gem we use). But also it won't be perfect as the events that come back haven't been resolved onto the calling users calendar/partner.
User story
As an admin I need add a calendar and see if the import is successful so that I can keep track of what stage of the process I am at and try to figure out any issues / relax and have confidence that placeCal is working.
It should also be quick - just added a calendar that took 20 mins to show up
Acceptance criteria
Implementation notes & questions
Noted in #1501
Implementation plan
To be written by the developer