Outliner with drag/drop reordering - part 2
The Shortcut seems to pickup the older one
I got the same problem during some time, exactly like if the Apple Watch kept a cache of the previous calendar event notes, because there was only one event in the calendar.
iCloud updating of the calendar event takes some time... Not the first time I note that.
@cvp It’s hours later and there are still 2 calendar items with same name.
@ihf Weird becuse when I create an event, I store its unique id (event title is not a key) in the outline file and when I update an outline file, I reuse this id to update the event, I don't create a 2nd one.
Did you use the outline.py on two devices on the same outline?
Édit: when you have tested the shortcut, days before The last version of outline.py, you had created manually an event to test the shortcut. Before testing the V01.06, did you remove these manual events? Perhaps, one of your two events is manual and the other automatic?
Version V01.07 - correction of bug "when automatic event was already existing, updating the outline did not update the event. Only add was ok"
but anyway, this bug does not explain how you could have two same events, please read and check my edit part in my previous post, and give feedback, thanks
@cvp I thought I had deleted the manual event but I suppose it’s possible that I did not. And yes I edited the same outline on two devices.
ihf last edited by ihf
@cvp I think I’m getting a little confused. I deleted the duplicate events and downloaded the latest version of outline.py. I then opened the outline and did a save. Should that now create a calendar event or do I have to create one with no content before it will save it there? In any case, I don’t see any event created on that date.
@ihf I did exactly what you did:
- delete existing event
- open the outline
- modify it
(did you modify it?)
- a new event is appeared
@cvp sorry, ignore that report. It works as expected and is quite useful on the Watch.
@cvp Correction to my correction. I ran version 1.07 on my iPhone and it correctly created an event. I just downloaded version 1.07 on my iPad and opened that outline and made a change and saved it now I have two events with the same outline name in the calendar.
@ihf I don't see any explication to your problem. Perhaps you did run on a second device before the calendar has been synced via iCloud on this device. I've remarked that iCloud calendar synchronization is not very quick.
Just to be sure, settings calendar/sync has to be set to "all events".
The only modification that I could do is: if the outline contains an eventid, that implies that an event has been already created, but if this eventid is not reachable (not yet synced), actually I create another event, I could give a message and bypass this new creation but in this case, the notes field would not be updated.
@cvp I’ll delete both events and try again on both devices. I’ll confirm that the first device has written the event before trying the second. Stay tuned.
@ihf The eventid is stored in the outline file, thus if you delete the event it-self, when the script tries to update the event, this one is not reachable thus the script should create a new one.
@cvp Sorry to report that it wrote 2 events for the same outline. It never erased the one from the iPad when it wrote the one from the iPhone.
Sorry to report that it wrote 2 events for the same outline. It never erased the one from the iPad when it wrote the one from the iPhone.
Annoying. That will say that the eventid of the "created on iPad" event is not reachable on iPhone.
I did not test on two devices because my outlines folder is local on my iPad. I need to change that for next tests. Sorry for you, but that will not be immediate.
@ihf The problem comes from the fact that eventIdentifier is not the same on different devices, and I thought it was shared on devices. My mistake, thus I have to search for a different solution. Sorry for you. but, I'll do it.
I think that I'll (try to) identify the event by its title and if I need to update it, even on another device, I'll search the event with the same title (at 20220101 01:01 in Outline calendar ) If not found, I create it, else I update it.
Version V01.08 - correction of bug "eventIdentifier not shared cross devices for outline event"
Nb: - if you rename the outline file, renaming the event title is not yet supported
- this problem of eventIdentifier not shared on different devices has the same consequences for events for due dates (remember problems we got) but I'm not ready to correct this part because it has a lot of implications. Sorry.
you have to manually remove events and install the same version on all devices before testing
@cvp I may not be understanding this correctly but could you just put a unique identifier in the outline file and in the event and use that?
@ihf I could, but I would have to scan all events of the day to find the right one. That is what I hoped with the eventIdentifier field of the event, without knowing that this id was not the same on all devices, thus not unique. I use now the outline file name which is unique by definiTion.
I had used the identifier because it is the key of the calendar, you have a method to get the event from this id. But anyway, that should work now, at least for this outline event for the Apple Watch.
could you just put a unique identifier in the outline file and in the event and use that?
Do you want that I manage an own unique field, like this:
- when I create a new outline event, I store in location (unique free field in a calendar event) a string equal to date time now, so we would be sure it's unique because you would not run the script exactly at the same time on two different devices.
- I store this value also in the outline file it-self
- when I update an outline, I will scan calendar events in calendar "Outline" with start date = 20220101 01:01 to find the same unique field as this one stored in the file, so I could update the notes field
@cvp I don't have any preference as to how to prevent duplicate events. I would go with whatever you think is most efficient in the script.
By the way, would it be possible for the script to check for updates automatically (or as a menu item?). I have 3 devices I am using with Outline and on each one I am updating Outline.py as well as outline.versions to be sure that any problems that might arise are using the latest versions. Of course, this assume that you will continue to be interested in enhancing this incredibly useful program. (Also, having the outlines on the Apple Watch has proved very useful!)
Version V01.09 - check and ask to automatically install new version if available
From this version, at start, the program will:
checkif a new version is available on GitHub (needs internet )
- if yes, warn the user and ask him if he wants its automatic installation
- if yes,
installautomatically the new .versions and .py files in folder of running script
- warn the user to restart the program (this is not automatic, let's not make the user lazy 😂)
Not only checking as requested but also installing...
Not yet testable as is, but as soon you tell me that you have installed it on your devices, I'll create a dummy new version, without any modification, only for testing this one.
Or a version which writes event notes with emoji for checkbox. If you like it, tell me, and you can even decide which emojis you want for checked and unchecked.