bergercookie / syncall

Bi-directional synchronization between services such as Taskwarrior, Google Calendar, Notion, Asana, and more
MIT License
456 stars 41 forks source link

Map TW/CalDAV entry/end <-> CREATED/COMPLETED #86

Closed bjornfor closed 11 months ago

bjornfor commented 1 year ago

Description

This change adds synchronization of the 'entry' and 'end' properties between Taskwarrior and CalDAV 'CREATED' and 'COMPLETED' properties.

This is for people with long history of tasks, where preserving the original create / complete timestamps is valuable.

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

I have run it against my Taskwarrior and Nextcloud (CalDAV) setup. Only one-way sync from Taskwarrior to CalDAV was tested (I'm migrating away from Taskwarrior).

Checklist:

bjornfor commented 1 year ago

I've marked it as draft because I haven't tested syncing "the other way" (CalDAV -> Taskwarrior), and because I wondered if I'd need to write something in syncall/taskwarrior/taskwarrior_side.py (specifically, add_item()).

bergercookie commented 1 year ago

I've tried testing this using radicale as the caldav server but it doesn't seem to expose the CREATED and COMPLETED fields at all, at least I don't see them when fetching all the events here

I'm a bit hesitant to merge this since it might be easy in the future to introduce regressions (i.e., I wont' be able to test / reproduce it). I'll keep this open though until I have a better way of testing it.

bjornfor commented 1 year ago

I've tried testing this using radicale as the caldav server but it doesn't seem to expose the CREATED and COMPLETED fields at all, at least I don't see them when fetching all the events here

Grepping for CREATED and COMPLETED in https://github.com/Kozea/Radicale:

$ git grep CREATED
radicale/app/mkcalendar.py:            return client.CREATED, {}, None
radicale/app/mkcol.py:            return client.CREATED, {}, None
radicale/app/move.py:            return client.NO_CONTENT if to_item else client.CREATED, {}, None
radicale/app/put.py:            return client.CREATED, headers, None
radicale/tests/static/broken-vevent.ics:CREATED:20160725T060147Z
radicale/tests/static/event1.ics:CREATED:20130902T150157Z
radicale/tests/static/event1_modified.ics:CREATED:20130902T150157Z
radicale/tests/static/event2.ics:CREATED:20130902T150157Z
radicale/tests/static/event3.ics:CREATED:20130902T150157Z
radicale/tests/static/event4.ics:CREATED:20130902T150157Z
radicale/tests/static/event5.ics:CREATED:20130902T150157Z
radicale/tests/static/event6.ics:CREATED:20170601T060000Z
radicale/tests/static/event6.ics:CREATED:20170601T060000Z
radicale/tests/static/event7.ics:CREATED:20170601T060000Z
radicale/tests/static/event7.ics:CREATED:20170601T060000Z
radicale/tests/static/event7.ics:CREATED:20170601T060000Z
radicale/tests/static/event8.ics:CREATED:20170601T060000Z
radicale/tests/static/event_mixed_datetime_and_date.ics:CREATED:20130902T150157Z
radicale/tests/static/event_timezone_seconds.ics:CREATED:20180420T193555Z
radicale/tests/static/todo5.ics:CREATED;TZID=Europe/Paris:20130903T180000
radicale/tests/static/todo7.ics:CREATED;TZID=Europe/Paris:20130803T180000
radicale/tests/static/todo9.ics:CREATED:20180102T122042Z

$ git grep COMPLETED
radicale/tests/static/todo5.ics:COMPLETED;TZID=Europe/Paris:20130920T180000
radicale/tests/static/todo6.ics:COMPLETED;TZID=Europe/Paris:20130920T180000

So maybe CREATED is handled, but I'm pretty sure COMPLETED isn't.

bjornfor commented 1 year ago

I installed Radicale, created a task list in its web UI and used Evolution as a client to create and edit tasks.

One task, stored in /var/lib/radicale/collections/collection-root/bf/8d9dbbc4-2b06-130f-b61a-07a58b9b7afa/0cfe9f88442d53e929cf230c663196e8e25bbba0.ics, contains

BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
PRODID:-//Ximian//NONSGML Evolution Calendar//EN
BEGIN:VTODO
CLASS:PUBLIC
COMPLETED:20230102T000000Z
CREATED:20231111T125843Z
DTSTAMP:20231111T125659Z
DTSTART;VALUE=DATE:20200203
LAST-MODIFIED:20231111T130603Z
PERCENT-COMPLETE:70
SEQUENCE:6
STATUS:COMPLETED
SUMMARY:radicale test 42
UID:0cfe9f88442d53e929cf230c663196e8e25bbba0
END:VTODO
END:VCALENDAR

COMPLETED:... gets updated when manipulating "Date completed" in Evolution. I didn't see "CREATED" in Evolution, so I tried to use vdirsyncer, but ran into some other issues (mostly lack of time).

So maybe CREATED is handled, but I'm pretty sure COMPLETED isn't.

And based on the above test, Radicle definitely handles COMPLETED.

bergercookie commented 11 months ago

Hi @bjornfor ,

I've made a small change in caldav_utils in order to also process the created and completion date fields.

Other than that it works great on my end in both ways TW <> Caldav

bergercookie commented 11 months ago

Merged it! Thanks @bjornfor , happy new year :)

bjornfor commented 11 months ago

@bergercookie: Thanks! And a happy new year to you too!