first option detailed
This commit is contained in:
12
database.py
12
database.py
@@ -27,10 +27,17 @@ cur.executemany("INSERT INTO TIMESTAMPS VALUES (?, ?, ?, ?, ?)", timestamp_list)
|
||||
def get_all_stamps():
|
||||
return cur.execute("SELECT * FROM TIMESTAMPS;")
|
||||
|
||||
|
||||
def get_number_of_stamps(input):
|
||||
table_rows = []
|
||||
for row in cur.execute("SELECT * FROM TIMESTAMPS;"):
|
||||
table_rows.append(row)
|
||||
table_values = cur.execute("SELECT * FROM TIMESTAMPS;")
|
||||
|
||||
iterator = 0
|
||||
while (iterator < input):
|
||||
table_rows.append(table_values[iterator])
|
||||
iterator += 1
|
||||
|
||||
return table_rows
|
||||
|
||||
|
||||
def get_table_length():
|
||||
@@ -39,6 +46,7 @@ def get_table_length():
|
||||
table_rows.append(row)
|
||||
return len(table_rows)
|
||||
|
||||
|
||||
def get_stamp_by_date():
|
||||
pass
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ def handle_first_option():
|
||||
def find_row_limit():
|
||||
user_limit = input("How many rows? \n")
|
||||
table_length = get_table_length()
|
||||
|
||||
try:
|
||||
user_limit = int(user_limit)
|
||||
except ValueError:
|
||||
@@ -31,9 +32,26 @@ def handle_first_option():
|
||||
print("An unknown error occurred. Please try again.")
|
||||
find_row_limit()
|
||||
|
||||
if type(user_limit) is int:
|
||||
print(f'Returning first {user_limit} rows of data...')
|
||||
if (user_limit > table_length):
|
||||
print("Provided input is larger than available rows in table.")
|
||||
print("Printing all rows...")
|
||||
output = get_all_stamps()
|
||||
for row in output:
|
||||
print(row)
|
||||
else:
|
||||
table_rows = get_number_of_stamps(user_limit)
|
||||
for row in table_rows:
|
||||
print(row)
|
||||
|
||||
another_selection = input("Make another selection? y/n \n")
|
||||
|
||||
if another_selection == 'y':
|
||||
parse_input()
|
||||
elif another_selection == 'n':
|
||||
pass
|
||||
else:
|
||||
print("Make another selection:")
|
||||
parse_input()
|
||||
|
||||
find_row_limit()
|
||||
|
||||
@@ -41,6 +59,17 @@ def handle_first_option():
|
||||
print("Please provide a valid selection.")
|
||||
handle_first_option()
|
||||
|
||||
|
||||
def handle_second_option():
|
||||
pass
|
||||
|
||||
def handle_third_option():
|
||||
pass
|
||||
|
||||
def handle_fourth_option():
|
||||
pass
|
||||
|
||||
|
||||
def parse_input():
|
||||
print(user_prompt)
|
||||
response = input("Enter your selection: ")
|
||||
@@ -54,9 +83,13 @@ def parse_input():
|
||||
print("Please provide a valid input.")
|
||||
parse_input()
|
||||
|
||||
|
||||
|
||||
if type(response) == int:
|
||||
print(f'You selected {response}. Working...')
|
||||
|
||||
|
||||
|
||||
if response == 1:
|
||||
handle_first_option()
|
||||
elif response == 2:
|
||||
@@ -66,4 +99,5 @@ def parse_input():
|
||||
elif response == 4:
|
||||
pass
|
||||
else:
|
||||
pass
|
||||
print("Please provide a valid selection.")
|
||||
parse_input()
|
||||
Reference in New Issue
Block a user