Preparing timetable & notes for display
This commit is contained in:
parent
82d38498f8
commit
b56e9078a2
3 changed files with 129 additions and 11 deletions
|
@ -24,3 +24,41 @@ def get_notes(register_id, register_r, oun, s):
|
||||||
|
|
||||||
with open('json/notes.json', 'w') as f:
|
with open('json/notes.json', 'w') as f:
|
||||||
json.dump(notes_json, f)
|
json.dump(notes_json, f)
|
||||||
|
|
||||||
|
def prepare_notes_for_display():
|
||||||
|
with open('json/notes.json') as f:
|
||||||
|
notes = json.load(f)
|
||||||
|
|
||||||
|
print(notes)
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
print('------------------UWAGI------------------')
|
||||||
|
while True:
|
||||||
|
if notes['data']['Uwagi'] == []:
|
||||||
|
print('Brak uwag!')
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('------------------------------------')
|
||||||
|
print('Treść: '+notes['data']['Uwagi'][i]['TrescUwagi'])
|
||||||
|
print('Kategoria: '+notes['data']['Uwagi'][i]['Kategoria'])
|
||||||
|
print('Data: '+notes['data']['Uwagi'][i]['DataWpisu'])
|
||||||
|
print('Nauczyciel: '+notes['data']['Uwagi'][i]['Nauczyciel'])
|
||||||
|
print('Punkty: '+notes['data']['Uwagi'][i]['Punkty'])
|
||||||
|
|
||||||
|
if notes['data']['Uwagi'][i] == notes['data']['Uwagi'][-1]:
|
||||||
|
i = 0
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
print('------------------OSIĄGNIĘCIA------------------')
|
||||||
|
while True:
|
||||||
|
if notes['data']['Osiagniecia'] == []:
|
||||||
|
print('Brak osiągnięć!')
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print(notes['data']['Osiagniecia'][i])
|
||||||
|
if notes['data']['Osiagniecia'][i] == notes['data']['Osiagniecia'][-1]:
|
||||||
|
i = 0
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
|
|
@ -59,14 +59,93 @@ def prepare_timetable_for_display():
|
||||||
break
|
break
|
||||||
a += 1
|
a += 1
|
||||||
|
|
||||||
|
#while True:
|
||||||
|
#print(hour[i])
|
||||||
|
#print(monday[i])
|
||||||
|
#print(tuesday[i])
|
||||||
|
#print(wednesday[i])
|
||||||
|
#print(thrusday[i])
|
||||||
|
#print(friday[i])
|
||||||
|
#print('-------------------------------------')
|
||||||
|
#if hour[i] == hour[-1]:
|
||||||
|
#i = 0
|
||||||
|
#break
|
||||||
|
#i += 1
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
print(hour[i])
|
#<--------------HOURS-------------->
|
||||||
print(monday[i])
|
bs = BeautifulSoup(hour[i], 'html.parser')
|
||||||
print(tuesday[i])
|
hour[i] = [str.strip(x) for x in bs.strings if str.strip(x) != '']
|
||||||
print(wednesday[i])
|
unwanted_text = [str.strip(x.text) for x in bs.find_all()]
|
||||||
print(thrusday[i])
|
set(hour[i]).difference(unwanted_text)
|
||||||
print(friday[i])
|
|
||||||
print('-------------------------------------')
|
#<--------------MONDAY-------------->
|
||||||
|
bs = BeautifulSoup(monday[i], 'html.parser')
|
||||||
|
for lesson in bs.find_all('span'):
|
||||||
|
monday[i] = lesson.text
|
||||||
|
break
|
||||||
|
|
||||||
|
#<--------------TUESDAY-------------->
|
||||||
|
bs = BeautifulSoup(tuesday[i], 'html.parser')
|
||||||
|
for lesson in bs.find_all('span'):
|
||||||
|
tuesday[i] = lesson.text
|
||||||
|
break
|
||||||
|
|
||||||
|
#<--------------WEDNESDAY-------------->
|
||||||
|
bs = BeautifulSoup(wednesday[i], 'html.parser')
|
||||||
|
for lesson in bs.find_all('span'):
|
||||||
|
wednesday[i] = lesson.text
|
||||||
|
break
|
||||||
|
|
||||||
|
#<--------------THRUSDAY-------------->
|
||||||
|
bs = BeautifulSoup(thrusday[i], 'html.parser')
|
||||||
|
for lesson in bs.find_all('span'):
|
||||||
|
thrusday[i] = lesson.text
|
||||||
|
break
|
||||||
|
|
||||||
|
#<--------------FRIDAY-------------->
|
||||||
|
bs = BeautifulSoup(friday[i], 'html.parser')
|
||||||
|
for lesson in bs.find_all('span'):
|
||||||
|
friday[i] = lesson.text
|
||||||
|
break
|
||||||
|
|
||||||
|
if hour[i] == hour[-1]:
|
||||||
|
i = 0
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
print('<--------------MONDAY-------------->')
|
||||||
|
while True:
|
||||||
|
print(hour[i][1]+'-'+hour[i][2]+': '+monday[i])
|
||||||
|
if hour[i] == hour[-1]:
|
||||||
|
i = 0
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
print('<--------------TUESDAY-------------->')
|
||||||
|
while True:
|
||||||
|
print(hour[i][1]+'-'+hour[i][2]+': '+tuesday[i])
|
||||||
|
if hour[i] == hour[-1]:
|
||||||
|
i = 0
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
print('<--------------WEDNESDAY-------------->')
|
||||||
|
while True:
|
||||||
|
print(hour[i][1]+'-'+hour[i][2]+': '+wednesday[i])
|
||||||
|
if hour[i] == hour[-1]:
|
||||||
|
i = 0
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
print('<--------------THRUSDAY-------------->')
|
||||||
|
while True:
|
||||||
|
print(hour[i][1]+'-'+hour[i][2]+': '+thrusday[i])
|
||||||
|
if hour[i] == hour[-1]:
|
||||||
|
i = 0
|
||||||
|
break
|
||||||
|
i += 1
|
||||||
|
print('<--------------FRIDAY-------------->')
|
||||||
|
while True:
|
||||||
|
print(hour[i][1]+'-'+hour[i][2]+': '+friday[i])
|
||||||
if hour[i] == hour[-1]:
|
if hour[i] == hour[-1]:
|
||||||
i = 0
|
i = 0
|
||||||
break
|
break
|
||||||
|
|
|
@ -10,7 +10,9 @@ from .API.grades import prepare_grades_for_display
|
||||||
from .API.homework import prepare_homework_for_display
|
from .API.homework import prepare_homework_for_display
|
||||||
from .API.exams import prepare_exams_for_display
|
from .API.exams import prepare_exams_for_display
|
||||||
from .API.timetable import prepare_timetable_for_display
|
from .API.timetable import prepare_timetable_for_display
|
||||||
|
from .API.notes import prepare_notes_for_display
|
||||||
|
|
||||||
|
# Create your views here.
|
||||||
def default_view(request, *args, **kwargs):
|
def default_view(request, *args, **kwargs):
|
||||||
new_form = loginForm()
|
new_form = loginForm()
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
@ -88,9 +90,8 @@ def attendance_view(request, *args, **kwargs):
|
||||||
return render(request, 'frekwencja.html', content)
|
return render(request, 'frekwencja.html', content)
|
||||||
|
|
||||||
def notes_view(request, *args, **kwargs):
|
def notes_view(request, *args, **kwargs):
|
||||||
with open('json/notes.json') as f:
|
prepare_notes_for_display()
|
||||||
notes_load = json.load(f)
|
content = {'json_data': None}
|
||||||
content = {'json_data': notes_load}
|
|
||||||
return render(request, 'uwagi.html', content)
|
return render(request, 'uwagi.html', content)
|
||||||
|
|
||||||
def exams_view(request, *args, **kwargs):
|
def exams_view(request, *args, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue