Rename stuple

This commit is contained in:
Abdulkadir Furkan Şanlı 2019-01-15 16:57:53 +01:00
parent 201d2d4a65
commit 19559802d8
No known key found for this signature in database
GPG Key ID: 7823BD18E6F95D73

View File

@ -68,7 +68,7 @@ def get_data(conn):
return get_data(conn) return get_data(conn)
def select_final_time(conn, day, stuple): def select_final_time(conn, day, data):
"""Select student finishing time. """Select student finishing time.
Returns ending time (type struct_time) of final lesson student must Returns ending time (type struct_time) of final lesson student must
@ -76,7 +76,7 @@ def select_final_time(conn, day, stuple):
:param conn: Connection object :param conn: Connection object
:param day: current weekday, lowercase str :param day: current weekday, lowercase str
:param stuple: student data tuple returned by get_data :param data: student data tuple returned by get_data
""" """
cur = conn.cursor() cur = conn.cursor()
# Select finishing time of IB lessons. # Select finishing time of IB lessons.
@ -94,14 +94,14 @@ def select_final_time(conn, day, stuple):
AND lesson_class = ? AND lesson_class = ?
ORDER BY end_time DESC ORDER BY end_time DESC
LIMIT 1 LIMIT 1
""", (stuple[0], day, stuple[1])) # Queries return None if no matches. """, (data[0], day, data[1])) # Queries return None if no matches.
ib_finish = cur.fetchone() ib_finish = cur.fetchone()
if ib_finish is not None: if ib_finish is not None:
ib_finish = parse_time_string(ib_finish[0]) ib_finish = parse_time_string(ib_finish[0])
# Select finishing time of other lessons. # Select finishing time of other lessons.
others = [] others = []
for subject in stuple[2]: for subject in data[2]:
cur.execute(""" cur.execute("""
SELECT end_time SELECT end_time
FROM timetable FROM timetable
@ -111,7 +111,7 @@ def select_final_time(conn, day, stuple):
AND lesson_class = ? AND lesson_class = ?
ORDER BY end_time DESC ORDER BY end_time DESC
LIMIT 1 LIMIT 1
""", (subject, stuple[0], day, stuple[1])) """, (subject, data[0], day, data[1]))
subject_finish = cur.fetchone() subject_finish = cur.fetchone()
if subject_finish is not None: if subject_finish is not None:
others.append(parse_time_string(subject_finish[0])) others.append(parse_time_string(subject_finish[0]))