Fix select_final_time().
This commit is contained in:
		@@ -79,7 +79,7 @@ def select_final_time(conn, day, stuple):
 | 
			
		||||
        LIMIT 1
 | 
			
		||||
        """, (stuple[0], day, stuple[1]))
 | 
			
		||||
    ib_finish = cur.fetchone()
 | 
			
		||||
    if ib_finish != None:
 | 
			
		||||
    if ib_finish is not None:
 | 
			
		||||
        ib_finish = parse_time_string(ib_finish[0])
 | 
			
		||||
 | 
			
		||||
    others = []
 | 
			
		||||
@@ -94,19 +94,23 @@ def select_final_time(conn, day, stuple):
 | 
			
		||||
            ORDER BY end_time DESC
 | 
			
		||||
            LIMIT 1
 | 
			
		||||
            """, (sub, stuple[0], day, stuple[1]))
 | 
			
		||||
        other_final = cur.fetchone()
 | 
			
		||||
        if other_final != None:
 | 
			
		||||
            others.append(parse_time_string(other_final[0]))
 | 
			
		||||
        other_finish = cur.fetchone()
 | 
			
		||||
        if other_finish is not None:
 | 
			
		||||
            others.append(parse_time_string(other_finish[0]))
 | 
			
		||||
    if not others:
 | 
			
		||||
        other_finish = None
 | 
			
		||||
        others_finish = None
 | 
			
		||||
    else:
 | 
			
		||||
        other_finish = max(others)
 | 
			
		||||
        others_finish = max(others)
 | 
			
		||||
 | 
			
		||||
    if ib_finish != None and other_finish != None:
 | 
			
		||||
        if ib_finish > other_finish:
 | 
			
		||||
    if ib_finish is not None and others_finish is not None:
 | 
			
		||||
        if ib_finish > others_finish:
 | 
			
		||||
            finish = ib_finish
 | 
			
		||||
        else:
 | 
			
		||||
            finish = other_finish
 | 
			
		||||
            finish = others_finish
 | 
			
		||||
    elif ib_finish is not None:
 | 
			
		||||
        finish = ib_finish
 | 
			
		||||
    elif others_finish is not None:
 | 
			
		||||
        finish = others_finish
 | 
			
		||||
    else:
 | 
			
		||||
        finish = None
 | 
			
		||||
 | 
			
		||||
@@ -139,7 +143,7 @@ def main():
 | 
			
		||||
        elif finish_time < current_time:
 | 
			
		||||
            print("Student has finished for today, clear to leave.")
 | 
			
		||||
        else:
 | 
			
		||||
            print("Student still has lessons, clearance not granted.")
 | 
			
		||||
            print("\nStudent still has lessons, clearance not granted.")
 | 
			
		||||
 | 
			
		||||
        if input("Enter y to run again.") not in ["y", "Y"]:
 | 
			
		||||
            break
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user