From 774e419aa149f4b1682c41623ae51a8c1ccdbea7 Mon Sep 17 00:00:00 2001 From: Shaun Regenbaum Date: Sun, 20 Dec 2020 14:56:52 -0500 Subject: [PATCH] Fixed global variable error than did incorrent clocking --- clock_manager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/clock_manager.py b/clock_manager.py index 69b23a8..d1ec6b7 100644 --- a/clock_manager.py +++ b/clock_manager.py @@ -25,6 +25,7 @@ # Global Variables: minutes = hours_to_clock * 60 time_blocks = round(minutes / 15) +blocks_done = 0 driver = webdriver.Chrome(path_to_driver) wait = WebDriverWait(driver, 25) @@ -101,7 +102,7 @@ def clockHoursIn(status): print("You Have Clocked In, Be Careful That Your Computer Does Not Turn Off") - return 0 + return 1 except: print("Error, Unable to Clock In") return 0 @@ -134,10 +135,11 @@ def clockHoursOut(status): print("Error, Unable to Clock Out") return 0 -def goBackToMenu(status, blocks_done): +def goBackToMenu(status): if not status: return 0 + global blocks_done blocks_done = blocks_done + 1 try: @@ -161,11 +163,11 @@ def goBackToMenu(status, blocks_done): b = login(a) c = goToClock(b) -blocks_done = clockHoursIn(c) +d = clockHoursIn(c) # This is to prevent timing out: while blocks_done < time_blocks: - c = goToClock(goBackToMenu(c, blocks_done)) + d = goToClock(goBackToMenu(d)) # Run through every 15 minutes, the timeout happens at 20 minutes time.sleep(900)