diff --git a/syncall/tw_caldav_utils.py b/syncall/tw_caldav_utils.py index bd9da4b..b277d42 100644 --- a/syncall/tw_caldav_utils.py +++ b/syncall/tw_caldav_utils.py @@ -88,8 +88,12 @@ def convert_tw_to_caldav(tw_item: Item) -> Item: tw_item=tw_item, ) - # Priority - if "priority" in tw_item: + # Priority - tw treats priority as a UDA, so any custom options just ignore for now + if ( + "priority" in tw_item.keys() + and tw_item["priority"].lower() in aliases_tw_caldav_priority.keys() + ): + caldav_item["priority"] = aliases_tw_caldav_priority[tw_item["priority"].lower()] else: caldav_item["priority"] = "" diff --git a/tests/test_tw_caldav_conversions.py b/tests/test_tw_caldav_conversions.py index c84e5ec..0e32c9f 100644 --- a/tests/test_tw_caldav_conversions.py +++ b/tests/test_tw_caldav_conversions.py @@ -156,7 +156,7 @@ def caldav_item_with_priority(prio: int) -> dict: tw_pending_item_with_priority(tw_prio), caldav_item_with_priority(caldav_prio), ) - for tw_prio, caldav_prio in [("L", 9), ("M", 5), ("H", 1)] + for tw_prio, caldav_prio in [("L", 9), ("M", 5), ("H", 1), ("T", 0)] ), ], ids=[ @@ -169,6 +169,7 @@ def caldav_item_with_priority(prio: int) -> dict: "pending_item_with_priority_L", "pending_item_with_priority_M", "pending_item_with_priority_H", + "pending_item_with_priority_T", ], ) def test_convert_tw_to_caldav_n_back(tw_item, caldav_item_expected):