fix: schedule_week showing data

This commit is contained in:
mnjx
2023-04-24 09:37:57 +02:00
parent d9c1b6fc92
commit f7c2b541b5
+17 -4
View File
@@ -46,7 +46,7 @@ def get_schedule_week(url: str):
schedule_week = []
for i in range(len(rows)):
if rows[i].find("td", class_="KuvSuplovanaHodina") is not None and rows[i].find("td", class_="KuvSuplujiciHodina") is None and rows[i].find("td", class_="KuvSkolniAkceHodina") is None:
if rows[i].find("td", class_="KuvSuplovanaHodina") is not None and rows[i].find("td", class_="KuvSuplujiciHodina") is None and rows[i].find("td", class_="KuvSkolniAkceHodina") is None and rows[i].find("td", class_="DctInnerTableType10DataTD") is None:
continue
subjects = []
@@ -74,6 +74,8 @@ def get_schedule_week(url: str):
for j in range(len(subjects_)):
if "KuvSuplovanaHodina" not in subjects_[j].parent["class"]:
temp.append(subjects_[j].text)
else:
temp.append("Volno")
subjects = temp
F_continue = False
@@ -106,12 +108,23 @@ def get_schedule_week(url: str):
for j in range(len(cells)):
if cells[j].get("colspan") is not None:
if int(cells[j].get("colspan")) == 2:
subjects.insert(j, subjects[j-1])
wheres.insert(j, wheres[j-1])
try:
subjects.insert(j, subjects[j])
wheres.insert(j, wheres[j])
except IndexError:
pass
for j in range(len(subjects)):
if subjects[j] == "Volno":
wheres.insert(j, " - ")
while True:
if len(subjects) > len(wheres):
del subjects[-1]
elif len(subjects) < len(wheres):
del wheres[-1]
else:
break
if F_continue == False:
schedule_week_row = {
"DAY": day,
@@ -123,7 +136,7 @@ def get_schedule_week(url: str):
schedule_week.append(schedule_week_row)
sorted_schedule_week = sort_schedule_week(schedule_week)
return sorted_schedule_week
except AttributeError:
global not_login