diff --git a/data.db b/data.db index a7cb204..f2bd132 100644 Binary files a/data.db and b/data.db differ diff --git a/database.py b/database.py index daaac12..466075c 100644 --- a/database.py +++ b/database.py @@ -16,6 +16,9 @@ cur.execute("CREATE TABLE IF NOT EXISTS USERS (id INTEGER PRIMARY KEY, name STRI # 3) Calculate total hours for the week # 4) Calculate complete sum of hours +def get_created_id(timestamp): + return cur.execute("SELECT * FROM TIMESTAMPS WHERE time_in=:stamp", {"stamp": timestamp}) + def create_new_stamp(timestamp, name, purpose): to_insert = (timestamp, name, purpose) cur.execute("INSERT INTO TIMESTAMPS (time_in, name, purpose) VALUES (?, ?, ?)", to_insert) diff --git a/user_input.py b/user_input.py index df43be4..edd9cc4 100644 --- a/user_input.py +++ b/user_input.py @@ -8,10 +8,9 @@ This program is intended to help you keep track of your work hours on personal p Please choose from the following options: 1) Insert a new timestamp 2) Select all timestamps (option: limit number of results) -3) Find a timestamp by date range +3) Find a timestamp by session id 4) Calculate total hours for the week 5) Calculate complete sum of hours - """ # Inner functions detailed below: @@ -32,6 +31,9 @@ def handle_first_option(): handle_first_option() elif confirmation == 'y': create_new_stamp(time_of_stamp, name, purpose) + session_id = get_created_id(time_of_stamp) + for data in session_id: + print(f'Session id: {data[0]}') new_selection = input("Data entered. Make another selection? y/n ") if new_selection == 'y': parse_input() @@ -105,7 +107,9 @@ def handle_second_option(): def handle_third_option(): - pass + stamp = datetime.now() + array = test_select_new(stamp, 'mikayla', 'not python') + print(array) def __admin__(): print("ADMIN PORTAL") @@ -122,8 +126,7 @@ def __admin__(): if int(admin_prompt) == 1: print("Deleting all rows...") delete_all_rows() - print("All rows deleted. Returning...") - parse_input() + print("All rows deleted. Terminating program:") elif int(admin_prompt) == 2: print("Drop table. Confirm?") elif int(admin_prompt) == 3: @@ -159,11 +162,11 @@ def parse_input(): elif response == 2: handle_second_option() elif response == 3: - pass - elif response == 3: - pass + handle_third_option() elif response == 4: pass + elif response == 5: + pass elif response == 90909: __admin__() else: