first option detailed

This commit is contained in:
Mikayla Dobson
2022-04-06 12:06:14 -05:00
parent 1b804314da
commit 1880b60602
3 changed files with 50 additions and 8 deletions

View File

@@ -27,10 +27,17 @@ cur.executemany("INSERT INTO TIMESTAMPS VALUES (?, ?, ?, ?, ?)", timestamp_list)
def get_all_stamps(): def get_all_stamps():
return cur.execute("SELECT * FROM TIMESTAMPS;") return cur.execute("SELECT * FROM TIMESTAMPS;")
def get_number_of_stamps(input): def get_number_of_stamps(input):
table_rows = [] table_rows = []
for row in cur.execute("SELECT * FROM TIMESTAMPS;"): table_values = cur.execute("SELECT * FROM TIMESTAMPS;")
table_rows.append(row)
iterator = 0
while (iterator < input):
table_rows.append(table_values[iterator])
iterator += 1
return table_rows
def get_table_length(): def get_table_length():
@@ -39,6 +46,7 @@ def get_table_length():
table_rows.append(row) table_rows.append(row)
return len(table_rows) return len(table_rows)
def get_stamp_by_date(): def get_stamp_by_date():
pass pass

View File

@@ -22,6 +22,7 @@ def handle_first_option():
def find_row_limit(): def find_row_limit():
user_limit = input("How many rows? \n") user_limit = input("How many rows? \n")
table_length = get_table_length() table_length = get_table_length()
try: try:
user_limit = int(user_limit) user_limit = int(user_limit)
except ValueError: except ValueError:
@@ -31,9 +32,26 @@ def handle_first_option():
print("An unknown error occurred. Please try again.") print("An unknown error occurred. Please try again.")
find_row_limit() find_row_limit()
if type(user_limit) is int: if (user_limit > table_length):
print(f'Returning first {user_limit} rows of data...') 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() find_row_limit()
@@ -41,6 +59,17 @@ def handle_first_option():
print("Please provide a valid selection.") print("Please provide a valid selection.")
handle_first_option() handle_first_option()
def handle_second_option():
pass
def handle_third_option():
pass
def handle_fourth_option():
pass
def parse_input(): def parse_input():
print(user_prompt) print(user_prompt)
response = input("Enter your selection: ") response = input("Enter your selection: ")
@@ -54,9 +83,13 @@ def parse_input():
print("Please provide a valid input.") print("Please provide a valid input.")
parse_input() parse_input()
if type(response) == int: if type(response) == int:
print(f'You selected {response}. Working...') print(f'You selected {response}. Working...')
if response == 1: if response == 1:
handle_first_option() handle_first_option()
elif response == 2: elif response == 2:
@@ -66,4 +99,5 @@ def parse_input():
elif response == 4: elif response == 4:
pass pass
else: else:
pass print("Please provide a valid selection.")
parse_input()