Minor fixes and add TODO.md

This commit is contained in:
Abdulkadir Furkan Şanlı 2018-12-13 10:00:22 +01:00
parent 9db07eaa97
commit 2e7fa574bd
2 changed files with 17 additions and 9 deletions

11
TODO.md Normal file
View File

@ -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

View File

@ -98,27 +98,24 @@ def main():
print("============") print("============")
db = input( db = input(
"Please enter name of database (in same folder as program): ") "Please enter name of database (in same folder as program): ")
conn = connect_database(db)
y = "y" y = "y"
while y == "y": while y == "y":
conn = connect_database(db)
day = get_lower_weekday()
id = int(input("Please input the student ID number: ")) id = int(input("Please input the student ID number: "))
if check_id(conn, id): if check_id(conn, id):
day = get_lower_weekday()
raw_time = select_final_time(conn, day, id) raw_time = select_final_time(conn, day, id)
final_time = parse_time_string( # if raw_time is None, student has no lessons today
raw_time) if raw_time != None else None if raw_time != None:
final_time = parse_time_string(raw_time)
if final_time != None:
current_time = parse_time_string(time.strftime("%H:%M")) current_time = parse_time_string(time.strftime("%H:%M"))
if current_time > final_time: if current_time > final_time:
print("Clear to leave.") print("Clear to leave.")
else: else:
print("Student does not have clearance.") print("Student does not have clearance.")
elif raw_time == None:
elif final_time == None:
print("Clear to leave.") print("Clear to leave.")
else: else:
print("Student does not exist in the database. Please try again.") print("Student does not exist in the database. Please try again.")