gcalcli icon indicating copy to clipboard operation
gcalcli copied to clipboard

make it so that imported events retain UID and duplicate IDs will fail gracefully

Open tsheinen opened this issue 4 years ago • 4 comments

see #583 and #492

I modified this for my own purposes and I stopped at "it works for my use case and doesn't make any tests fail". I don't think I missed anything important but I don't mind spending some more time on it if needed. I think not importing defaults is pretty reasonable default behavior -- I personally would not expect an import to create duplicate events if the event IDs are the same. Thoughts?

tsheinen avatar Feb 02 '21 17:02 tsheinen

I don't have time to get familiar with that part of the codebase and review but I agree with your description of the desired behavior. Basically I think this should try to reproduce what the Google Calendar web interface does when given repeated imports of the same thing, which to my knowledge is as you describe.

michaelmhoffman avatar Feb 02 '21 17:02 michaelmhoffman

I have tested this PR and can confirm it works as expected, thanks!

pschmitt avatar Mar 01 '21 08:03 pschmitt

Here's more feedback:

In its current state this PR does not allow importing updated events (ie. SEQUENCE got incremented).

Ideally gcalcli would fetch the existing event (same UID) and update it if SEQUENCE has been incremented and ignore events who have not changed (same UID and same SEQUENCE)

pschmitt avatar Mar 03 '21 13:03 pschmitt

Updating events would be a much welcome behavior! It would be even better than a graceful fail.

May I suggest using service.events().import(**kwargs) instead of service.events().insert(**kwargs), when 'iCalUID' in event is True?

I did some tests from the google developers API page, the behavior of import seems correct.

I can create an other pull request but I wanted to have your thoughts first!

cryhot avatar May 12 '21 02:05 cryhot