Optimizing homework display
This commit is contained in:
parent
7a77a178cc
commit
3df0581b3a
2 changed files with 7 additions and 5 deletions
|
@ -42,7 +42,7 @@ def get_homework(register_id, register_r, oun, s, school_year):
|
|||
year4 = str(now4.year)
|
||||
date4 = year4+'-'+month4+'-'+day4
|
||||
|
||||
homework1 = s.post(oun+'/Homework.mvc/Get', headers={"User-Agent": "Wulkanowy-web :)"}, cookies=cookies, json={'schoolYear': school_year, 'date': date1, 'statusFilter': '-1'}) #'2020-09-28'
|
||||
homework1 = s.post(oun+'/Homework.mvc/Get', headers={"User-Agent": "Wulkanowy-web :)"}, cookies=cookies, json={'schoolYear': school_year, 'date': date1, 'statusFilter': '-1'})
|
||||
homework2 = s.post(oun+'/Homework.mvc/Get', headers={"User-Agent": "Wulkanowy-web :)"}, cookies=cookies, json={'schoolYear': school_year, 'date': date2, 'statusFilter': '-1'})
|
||||
homework3 = s.post(oun+'/Homework.mvc/Get', headers={"User-Agent": "Wulkanowy-web :)"}, cookies=cookies, json={'schoolYear': school_year, 'date': date3, 'statusFilter': '-1'})
|
||||
homework4 = s.post(oun+'/Homework.mvc/Get', headers={"User-Agent": "Wulkanowy-web :)"}, cookies=cookies, json={'schoolYear': school_year, 'date': date4, 'statusFilter': '-1'})
|
||||
|
|
|
@ -51,15 +51,17 @@ def simple_data(exam):
|
|||
else:
|
||||
return mark_safe('Brak Sprawdzianów')
|
||||
|
||||
homework_all = None
|
||||
|
||||
@register.filter
|
||||
def week_homework(no):
|
||||
global homework_all
|
||||
cookie = get_cookies()
|
||||
homework_all = prepare_homework_for_display(cookie[0], cookie[1], cookie[2], cookie[3], cookie[5])
|
||||
if homework_all == None:
|
||||
homework_all = prepare_homework_for_display(cookie[0], cookie[1], cookie[2], cookie[3], cookie[5])
|
||||
homework = []
|
||||
|
||||
for i in range(4):
|
||||
homework.append(homework_all[i][no])
|
||||
|
||||
print(homework)
|
||||
|
||||
|
||||
return homework
|
Loading…
Reference in a new issue