From 34eb40a0929857e64fb4615296a26688cea4d253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Melan=C3=A7on?= Date: Thu, 15 Dec 2022 10:56:52 -0500 Subject: [PATCH] Fix capture of pomodoro counts above 9, oops --- pomodoro_to_harvest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 472d7a8..e0accf4 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -119,7 +119,7 @@ timelog['description'] = timelog['description'].str.strip() # task), then multiply the time by it and remove it from the description. # Ensure we're splitting on the same asterisk we found: Use the end of string # signifier in the regular expression ($), and split from the right. -p = re.compile(r'\*\s*\d$') +p = re.compile(r'\*\s*\d+$') # On some systems, using np.where worked but others failed. Why it worked is # unknown but why it failed is because numpy where evaluates all parts, even # the parts that will never get used because the where clause does not apply! @@ -160,8 +160,8 @@ for preferred, alternatives in compound_project_tasks.items(): # 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['project'].str.split('—', 1).str[0], timelog['project'])) +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['project'].str.split(' — ', 1).str[0], timelog['project'])) # Replace irregular-but-known project names with ones timetracking tools use. harvest_project_names = {