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