Skip to content

Commit

Permalink
Remove the taskw_duration file
Browse files Browse the repository at this point in the history
It's now part of the taskw_ng repo so we shouldn't make the serialization/deserialization twice
Effectively fixes the upstream issue: ralphbean/taskw#160
  • Loading branch information
bergercookie committed Jan 29, 2024
1 parent 6f478be commit 6af7b63
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 175 deletions.
153 changes: 0 additions & 153 deletions syncall/taskwarrior/taskw_duration.py

This file was deleted.

11 changes: 2 additions & 9 deletions syncall/taskwarrior/taskwarrior_side.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,10 @@
from xdg import xdg_config_home

from syncall.sync_side import ItemType, SyncSide
from syncall.taskwarrior.taskw_duration import (
convert_tw_duration_serialize,
convert_tw_duration_to_timedelta,
tw_duration_key,
)
from syncall.types import TaskwarriorRawItem

tw_duration_key = "syncallduration"

OrderByType = Literal[
"description",
"end",
Expand Down Expand Up @@ -220,8 +217,6 @@ def add_item(self, item: ItemType) -> ItemType:
description = item.pop("description")
len_print = min(20, len(description))

convert_tw_duration_serialize(item=item)

logger.trace(f'Adding task "{description[0:len_print]}" with properties:\n\n{item}')
new_item = self._tw.task_add(description=description, **item) # type: ignore
new_id = new_item["id"]
Expand Down Expand Up @@ -297,6 +292,4 @@ def items_are_identical(
if "modified" in item:
item["modified"] = parse_datetime_(item["modified"])

convert_tw_duration_to_timedelta(item)

return SyncSide._items_are_identical(item1, item2, keys)
15 changes: 2 additions & 13 deletions syncall/tw_gcal_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@
from item_synchronizer.types import Item

from syncall.google.gcal_side import GCalSide
from syncall.taskwarrior.taskw_duration import (
convert_tw_duration_to_timedelta,
taskw_duration_serialize,
tw_duration_key,
)
from syncall.taskwarrior.taskwarrior_side import tw_duration_key
from syncall.tw_utils import (
extract_tw_fields_from_string,
get_tw_annotations_as_str,
Expand Down Expand Up @@ -71,10 +67,6 @@ def convert_tw_to_gcal(
)

date_keys = ["scheduled", "due"] if prefer_scheduled_date else ["due", "scheduled"]
# event duration --------------------------------------------------------------------------
# use the UDA field to fetch the duration of the event, otherwise fallback to the default
# duration
convert_tw_duration_to_timedelta(tw_item)

# handle start, end datetimes -------------------------------------------------------------
# walk through the date_keys using the first of them that's present in the item at hand.
Expand Down Expand Up @@ -167,10 +159,7 @@ def convert_gcal_to_tw(

end_time = GCalSide.get_event_time(gcal_item, t="end")

tw_item[tw_duration_key] = taskw_duration_serialize(
end_time - GCalSide.get_event_time(gcal_item, t="start")
)

tw_item[tw_duration_key] = end_time - GCalSide.get_event_time(gcal_item, t="start")
tw_item[date_key] = end_time

# Note:
Expand Down

0 comments on commit 6af7b63

Please sign in to comment.