From 2e7fa574bdd5b1773c8624bdc57bc68bfac2bfb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdulkadir=20Furkan=20=C5=9Eanl=C4=B1?= Date: Thu, 13 Dec 2018 10:00:22 +0100 Subject: [PATCH] Minor fixes and add TODO.md --- TODO.md | 11 +++++++++++ ib-clearance.py | 15 ++++++--------- 2 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..31681ee --- /dev/null +++ b/TODO.md @@ -0,0 +1,11 @@ +To-Do List +========== + +## v0.2 +- [ ] Error handling +- [ ] Make database contain data for all classes +- [ ] Flexible mandatory subjects + +## v1.0 +- [ ] make main() purely functional +- [ ] timetable editor diff --git a/ib-clearance.py b/ib-clearance.py index df1076a..b7e3382 100755 --- a/ib-clearance.py +++ b/ib-clearance.py @@ -98,27 +98,24 @@ def main(): print("============") db = input( "Please enter name of database (in same folder as program): ") + conn = connect_database(db) y = "y" while y == "y": - conn = connect_database(db) - day = get_lower_weekday() id = int(input("Please input the student ID number: ")) if check_id(conn, id): + day = get_lower_weekday() raw_time = select_final_time(conn, day, id) - final_time = parse_time_string( - raw_time) if raw_time != None else None - - if final_time != None: + # if raw_time is None, student has no lessons today + if raw_time != None: + final_time = parse_time_string(raw_time) current_time = parse_time_string(time.strftime("%H:%M")) - if current_time > final_time: print("Clear to leave.") else: print("Student does not have clearance.") - - elif final_time == None: + elif raw_time == None: print("Clear to leave.") else: print("Student does not exist in the database. Please try again.")