From a758526bfc32a46c8430096daa4eacfe54b673b1 Mon Sep 17 00:00:00 2001 From: Mikayla Dobson <93477693+innocuous-symmetry@users.noreply.github.com> Date: Wed, 6 Apr 2022 15:17:45 -0500 Subject: [PATCH] defined function to provide user with session id --- data.db | Bin 12288 -> 12288 bytes database.py | 3 +++ user_input.py | 19 +++++++++++-------- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/data.db b/data.db index a7cb204fc6ea4c1229b1944e287e709868d71e4c..f2bd1324848518d23d475cce9dd48d40e943d4ef 100644 GIT binary patch delta 215 zcmZojXh@hK&8R(5#+gxjW5N=C9v1#U2L6lui}|bh12+o_IP%wPu&^;WGKh*A85kMq z8kp!Bm?;>VS{a&K85-#s8=Dvyn-rF(=7X>rGf1VdFq%p;D`PV~BO^;=Q;
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: