From aa05dc5734acae4f331ac9ce4551fb9090e743d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20Melan=C3=A7on?= Date: Wed, 2 Jun 2021 08:56:01 -0400 Subject: [PATCH] Keep a version of harvest data around with same keys other stuff has, before renaming columns --- pomodoro_to_harvest.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pomodoro_to_harvest.py b/pomodoro_to_harvest.py index 9c9763c..869d91f 100644 --- a/pomodoro_to_harvest.py +++ b/pomodoro_to_harvest.py @@ -168,20 +168,22 @@ latest = tl.recorded.max() # Separate Harvest from non-Harvest projects, and also filter out any blank # projects, but save those too for a CSV of the excluded items. -harvest = tl[tl.project.isin(harvest_project_names.keys())] +hrvst = tl[tl.project.isin(harvest_project_names.keys())] other = tl[tl.project.isin(other_project_names.keys())] unknown = tl[~tl.project.isin(replacement_project_names.keys())] -harvest.rename(columns = {'date': 'Date', 'project': 'Project', 'description': 'Note'}, inplace = True) +harvest = hrvst.rename(columns = {'date': 'Date', 'project': 'Project', 'subproject': 'Task', 'description': 'Note'}) +harvest["Hours"] = harvest["time"]/60 harvest["First name"] = "Benjamin" harvest["Last name"] = "Melançon" +harvest.drop(columns = ['started', 'recorded', 'time'], inplace=True) if not debug: harvest.to_csv('harvest-timesheets.csv', index=False) other.to_csv('not-harvest.csv', index=False) settings.pomodoro_latest_recorded(latest) else: - harvest_grouped = harvest.groupby("project").agg({"time": "sum"})["time"]/60 + hrvst_grouped = hrvst.groupby("project").agg({"time": "sum"})["time"]/60 other_grouped = other.groupby("project").agg({"time": "sum"})["time"]/60 unknown_grouped = unknown.groupby("project").agg({"time": "sum"})["time"]/60 print("We do not write to the harvest-ready.csv nor update the latest recorded setting when run interactively in the python shell.")