Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged

Conversation

bjornfor
Copy link
Contributor

@bjornfor bjornfor commented May 9, 2023

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.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

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:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@bjornfor
Copy link
Contributor Author

bjornfor commented May 9, 2023

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
Copy link
Owner

bergercookie commented Nov 11, 2023

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
Copy link
Contributor Author

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
Copy link
Contributor Author

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.

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.
@bergercookie bergercookie force-pushed the add-timestamps-created-and-completed branch from 8df5dc7 to 2fe0225 Compare December 31, 2023 10:27
@bergercookie bergercookie marked this pull request as ready for review December 31, 2023 10:29
@bergercookie bergercookie force-pushed the add-timestamps-created-and-completed branch from 2fe0225 to afe2789 Compare December 31, 2023 10:29
@bergercookie
Copy link
Owner

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 bergercookie force-pushed the add-timestamps-created-and-completed branch from afe2789 to 26d758e Compare December 31, 2023 10:31
@bergercookie bergercookie merged commit 2c1da84 into bergercookie:master Dec 31, 2023
7 checks passed
@bergercookie
Copy link
Owner

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

@bjornfor bjornfor deleted the add-timestamps-created-and-completed branch December 31, 2023 15:13
@bjornfor
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants