From d4bc9dd22a191a8da9152189e124e03d42a30c5a Mon Sep 17 00:00:00 2001 From: bain Date: Thu, 11 Aug 2022 23:38:41 +0200 Subject: [PATCH] fix hour*wage calc --- toggl2sheets.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toggl2sheets.py b/toggl2sheets.py index 3d4e2f0..87033e2 100644 --- a/toggl2sheets.py +++ b/toggl2sheets.py @@ -70,14 +70,14 @@ today = datetime.datetime.now().date() - datetime.timedelta(days=1) def append_hours(worksheet: Worksheet, data: List[List[str]]): - # add a calculated hours * wage cell to all rows - # start at number 2 to skip header - d = [[*x, f"=C{i}*D{i}"] for i, x in enumerate(data, start=2)] column = worksheet.get_col(1) # get last non-empty row last_row = next(filter(lambda x: not x[1], enumerate(column)))[0] + # add a calculated hours * wage cell to all rows + d = [[*x, f"=C{i}*D{i}"] for i, x in enumerate(data, start=last_row + 1)] + worksheet.insert_rows(last_row, len(d), d) # inserting rows changes the top sums