Skip to content

Commit

Permalink
fix: Overwriting clock in
Browse files Browse the repository at this point in the history
change: I used the enumerate method to get the idex of the current date's row.
issue: The first row of the id's clock in time was overwritten instead of today's clock in time.
reason: I used the find method of the gspread package and it returns the first matching cell.
  • Loading branch information
sejungkwak committed Jun 1, 2022
1 parent f01e1e2 commit 5a0bc34
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,12 @@ def clock_in(id):
clock_sheet = SHEET.worksheet("clockings")
clockings = clock_sheet.get_all_values()
clear()
for clocking in clockings:
for row_index, clocking in enumerate(clockings, start=1):
user_id, date, clocked_in, clocked_out = clocking

if id == user_id and today == date and clocked_in:
is_overwrite = check_for_clockin_overwrite(clocked_in)
if is_overwrite == "Y":
row_index = clock_sheet.find(id).row
clock_in_col = 3
clock_sheet.update_cell(row_index, clock_in_col, clock_in_at)
print(f"Clock in time has been updated: {clock_in_at}")
Expand Down

0 comments on commit 5a0bc34

Please sign in to comment.