From ab951f5b86b0e0c759c6bf37158406a3290dc5c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Melan=C3=A7on?= Date: Tue, 1 Jun 2021 16:43:57 -0400 Subject: [PATCH] Split out subproject --- pomodoro_to_harvest.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 0733e3e..15e698c 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -141,6 +141,11 @@ for preferred, alternatives in replacement_project_names.items(): alternatives = [item.lower() for item in alternatives] timelog.loc[timelog.project.str.lower().isin(alternatives), "project"] = preferred +# If a compound project was specified, break that out into a sub-project (in +# Harvest, we use Task, which is really task type, for this. +timelog['subproject'] = (np.where(timelog['project'].str.contains(': '), timelog['project'].str.split(': ', 1).str[1], None)) +timelog['project'] = (np.where(timelog['project'].str.contains(': '), timelog['description'].str.split(': ', 1).str[0], timelog['description'])) + # Condense duplicate entries by date, summing the minutes spent, and listing # the first started and last recorded times for each task. # The fillna is essential or we drop entries with blank ('None') projects.