From a373440311ad4b9d45e4f5e47ddd171cdf1366ee Mon Sep 17 00:00:00 2001 From: Mikayla Dobson <93477693+innocuous-symmetry@users.noreply.github.com> Date: Wed, 6 Apr 2022 11:12:40 -0500 Subject: [PATCH] init commit --- data.db | Bin 0 -> 12288 bytes database.py | 41 +++++++++++++++++++++++++++++++++++++++++ user_input.py | 16 ++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 data.db create mode 100644 database.py create mode 100644 user_input.py diff --git a/data.db b/data.db new file mode 100644 index 0000000000000000000000000000000000000000..49a92c987c8578e521daa0c516fd268c410db0b6 GIT binary patch literal 12288 zcmeI#y=ucS5C?F{DP-!$=Jm2A5DKL)P&bHR8i!O;hfKz86)K4BV9SM$ezrbVmpUd+ znjve4@E1tFJ7IMGd6IgbS!ZaK7ir??p4~9c*#i+{%xh+^ncdjt7hTdk`Jeby=&{?$ z_hqx|UH!1@RkL6~00Izz00bZa0SG_<0uX=z1pZgRdVSybd41=S*R^?3LaKJ@O{564 zARRo;1hpj^+II@)T1#z1K9Y#XwAX=zHz{}fB*y_009U<00Izz I00eddzn8UF(EtDd literal 0 HcmV?d00001 diff --git a/database.py b/database.py new file mode 100644 index 0000000..5f9e7da --- /dev/null +++ b/database.py @@ -0,0 +1,41 @@ +import sqlite3 +from user_input import * + +# establish a connection to a .db file and create a cursor object +con = sqlite3.connect('data.db') +cur = con.cursor() + +# create initial tables +cur.execute("CREATE TABLE IF NOT EXISTS TIMESTAMPS (session_id INTEGER PRIMARY KEY, time_in STRING, time_out STRING, name STRING, purpose STRING);") +cur.execute("CREATE TABLE IF NOT EXISTS USERS (id INTEGER PRIMARY KEY, name STRING, cumulative_hours INTEGER);") + +# declare and insert some initial values +timestamp_list = [ + (1, '1pm', 'null', 'Mikayla', 'work on project'), + (2, '9pm', '11pm', 'not Mikayla', 'work on project'), + (3, '8am', '5pm', 'someone else', 'debugging') +] + +cur.executemany("INSERT INTO TIMESTAMPS VALUES (?, ?, ?, ?, ?)", timestamp_list) + + +""" + +# The below logic for testing initial values are inserted, +# are able to be queried, +# and are accurately represented in the table. + +# query table below: +table_rows = [] +for row in cur.execute("SELECT * FROM TIMESTAMPS;"): + # print each result + print(row) + # store each result individually in the list above + table_rows.append(row) + +# find COUNT(*) for the table +print(len(table_rows)) + +""" + +parse_input() diff --git a/user_input.py b/user_input.py new file mode 100644 index 0000000..bc0f263 --- /dev/null +++ b/user_input.py @@ -0,0 +1,16 @@ +user_prompt = """ +Welcome to the personal time stamp program. +This program is intended to help you keep track of your work hours on personal projects. + +Please choose from the following options: +1) Select all timestamps +2) Find a timestamp by date range +3) Calculate total hours for the week +4) Calculate complete sum of hours +""" + +def parse_input(): + print(user_prompt) + response = input("Enter your selection: ") + + print() \ No newline at end of file