fix hour*wage calc

This commit is contained in:
bain 2022-08-11 23:38:41 +02:00
parent c017c80a22
commit d4bc9dd22a
No known key found for this signature in database
GPG key ID: A708F07AF3D92C02

View file

@ -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