Resolve conflicts

This commit is contained in:
Tomasz 2021-02-05 21:19:36 +01:00
commit ded99523a0
18 changed files with 3216 additions and 59 deletions

View file

@ -20,13 +20,13 @@ def get_dashboard(register_id, students, s, diary_url, symbol):
permissions_value = permissions_value.group()
permissions_value = permissions_value.replace('permissions: ', '').replace("'", "")
payload = {
permissions = {
"permissions": permissions_value
}
last_notes = requests.post(f'{diary_url}{symbol}/Start.mvc/GetLastNotes', headers=headers, cookies=cookies, json=payload)
free_days = requests.post(f'{diary_url}{symbol}/Start.mvc/GetFreeDays', headers=headers, cookies=cookies, json=payload)
lucky_number = requests.post(f'{diary_url}{symbol}/Start.mvc/GetKidsLuckyNumbers', headers=headers, cookies=cookies, json=payload)
last_notes = requests.post(f'{diary_url}{symbol}/Start.mvc/GetLastNotes', headers=headers, cookies=cookies, json=permissions)
free_days = requests.post(f'{diary_url}{symbol}/Start.mvc/GetFreeDays', headers=headers, cookies=cookies, json=permissions)
lucky_number = requests.post(f'{diary_url}{symbol}/Start.mvc/GetKidsLuckyNumbers', headers=headers, cookies=cookies, json=permissions)
return_data = {
"last_notes": last_notes.json(),

View file

@ -63,14 +63,8 @@ def get_recipients(register_id, students, oun, s, date, school_year, symbol):
return {'addressee': get_addressee.json(), 'unitId': id_jednostka}
def send_message(register_id, students, oun, s, date, school_year, symbol, send_data):
headers = {
'Accept-Encoding': 'gzip, deflate, br',
'Accet': '*/*',
'Connection': 'keep-alive',
"User-Agent": "Wulkanowy-web :)",
'Content-Type': 'application/json',
'TE': "Trailers"
}
with open('app/API/headers.json') as f:
headers = json.load(f)
if oun == 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
link = f'http://uonetplus-uzytkownik.fakelog.cf/{symbol}'
@ -96,7 +90,9 @@ def send_message(register_id, students, oun, s, date, school_year, symbol, send_
sess.headers.update({
'X-V-RequestVerificationToken': antiForgeryToken,
'X-V-AppGuid': appGuid
'X-V-AppGuid': appGuid,
'Content-Type': 'application/json',
'TE': "Trailers"
})
payload = {
@ -177,4 +173,10 @@ def get_message_content(register_id, students, oun, s, date, school_year, symbol
content = sess.post(f'{link}/Wiadomosc.mvc/GetInboxMessageDetails', data=json.dumps(payload))
if content.status_code != 200:
while True:
content = sess.post(f'{link}/Wiadomosc.mvc/GetInboxMessageDetails', data=json.dumps(payload))
if content.status_code == 200:
break
return content.json()

View file

@ -13,29 +13,10 @@ def get_registered_devices(register_id, students, oun, s):
return registered.json()
def register_device(register_id, students, oun, s):
cookies = s
if oun != 'http://uonetplus-uczen.fakelog.cf/powiatwulkanowy/123458':
cookies.update({
"biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyDziennikWychowankowie": f"{students['data'][0]['IdWychowankowieDziennik']}",
"idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
})
else:
cookies.update({
"biezacyRokSzkolny": f"{students['data'][0]['DziennikRokSzkolny']}",
"idBiezacyDziennik": f"{students['data'][0]['IdDziennik']}",
"idBiezacyDziennikPrzedszkole": f"{students['data'][0]['IdPrzedszkoleDziennik']}",
"idBiezacyUczen": f"{students['data'][0]['IdUczen']}"
})
cookies = autogenerate_cookies(students, s)
headers = {
'Accept-Encoding': 'gzip, deflate',
'Accept': '*/*',
'Connection': 'keep-alive',
"User-Agent": "Wulkanowy-web :)"
}
with open('app/API/headers.json') as f:
headers = json.load(f)
register_data = requests.post(oun+'/RejestracjaUrzadzeniaToken.mvc/Get', headers=headers, cookies=cookies)

24
app/API/stats.py Normal file
View file

@ -0,0 +1,24 @@
import json
import requests
from .generate_cookies import autogenerate_cookies
def get_partial(register_id, students, oun, s):
cookies = autogenerate_cookies(students, s)
with open('app/API/headers.json') as f:
headers = json.load(f)
partial = requests.post(oun+'/Statystyki.mvc/GetOcenyCzastkowe', headers=headers, cookies=cookies, json={'idOkres': register_id})
return partial.json()
def get_year(register_id, students, oun, s):
cookies = autogenerate_cookies(students, s)
with open('app/API/headers.json') as f:
headers = json.load(f)
year = requests.post(oun+'/Statystyki.mvc/GetOcenyRoczne', headers=headers, cookies=cookies, json={'idOkres': register_id})
return year.json()

View file

@ -20,7 +20,9 @@ from .API.mobile_access import get_registered_devices, register_device
from .API.school_data import get_school_data
from .API.dashboard import get_dashboard
from .API.student_data import get_student_data
from .API.stats import get_partial, get_year
from .decrypt import decrypt_cookies
import datetime
#API
def login(request, *args, **kwargs):
@ -68,13 +70,30 @@ def grades(request, *args, **kwargs):
def timetable(request, *args, **kwargs):
if request.session.has_key('is_logged'):
data = json.loads(request.body)
week = data['week']
data = json.loads(data['cookies'])
register_id = data['data']['register_id']
students = data['data']['students']
oun = data['data']['oun']
s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key)
date = data['data']['date']
now = datetime.datetime.now()
weekday = now.weekday()
for x in range(7):
if weekday == x:
now = now - datetime.timedelta(days=x)
now = now + datetime.timedelta(days=week*7)
day = now.day
month = now.month
year = now.year
date = datetime.date(year, month, day).isoformat()
date = f'{date}T00:00:00'
timetable = get_timetable(register_id, students, oun, s, date)
return JsonResponse(timetable)
else:
@ -83,13 +102,30 @@ def timetable(request, *args, **kwargs):
def exams(request, *args, **kwargs):
if request.session.has_key('is_logged'):
data = json.loads(request.body)
week = data['week']
data = json.loads(data['cookies'])
register_id = data['data']['register_id']
students = data['data']['students']
oun = data['data']['oun']
s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key)
date = data['data']['date']
now = datetime.datetime.now()
weekday = now.weekday()
for x in range(7):
if weekday == x:
now = now - datetime.timedelta(days=x)
now = now + datetime.timedelta(days=week*7)
day = now.day
month = now.month
year = now.year
date = datetime.date(year, month, day).isoformat()
date = f'{date}T00:00:00'
school_year = data['data']['school_year']
exams = get_exams(register_id, students, oun, s, date, school_year)
return JsonResponse(exams)
@ -99,13 +135,30 @@ def exams(request, *args, **kwargs):
def homeworks(request, *args, **kwargs):
if request.session.has_key('is_logged'):
data = json.loads(request.body)
week = data['week']
data = json.loads(data['cookies'])
register_id = data['data']['register_id']
students = data['data']['students']
oun = data['data']['oun']
s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key)
date = data['data']['date']
now = datetime.datetime.now()
weekday = now.weekday()
for x in range(7):
if weekday == x:
now = now - datetime.timedelta(days=x)
now = now + datetime.timedelta(days=week*7)
day = now.day
month = now.month
year = now.year
date = datetime.date(year, month, day).isoformat()
date = f'{date}T00:00:00'
school_year = data['data']['school_year']
homeworks = get_homeworks(register_id, students, oun, s, date, school_year)
return JsonResponse(homeworks)
@ -115,13 +168,30 @@ def homeworks(request, *args, **kwargs):
def attendance(request, *args, **kwargs):
if request.session.has_key('is_logged'):
data = json.loads(request.body)
week = data['week']
data = json.loads(data['cookies'])
register_id = data['data']['register_id']
students = data['data']['students']
oun = data['data']['oun']
s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key)
date = data['data']['date']
now = datetime.datetime.now()
weekday = now.weekday()
for x in range(7):
if weekday == x:
now = now - datetime.timedelta(days=x)
now = now + datetime.timedelta(days=week*7)
day = now.day
month = now.month
year = now.year
date = datetime.date(year, month, day).isoformat()
date = f'{date}T00:00:00'
attendance = get_attendance(register_id, students, oun, s, date)
return JsonResponse(attendance, safe=False)
else:
@ -318,6 +388,35 @@ def student_data(request, *args, **kwargs):
else:
return redirect('../')
#STATS
def partial(request, *args, **kwargs):
if request.session.has_key('is_logged'):
data = json.loads(request.body)
register_id = data['data']['register_id']
students = data['data']['students']
oun = data['data']['oun']
s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key)
partial_stats = get_partial(register_id, students, oun, s)
return JsonResponse(partial_stats)
else:
return redirect('../')
def year(request, *args, **kwargs):
if request.session.has_key('is_logged'):
data = json.loads(request.body)
register_id = data['data']['register_id']
students = data['data']['students']
oun = data['data']['oun']
s = data['data']['s']
key = bytes(request.session[request.session.session_key], 'utf-8')
s = decrypt_cookies(s, key)
year_stats = get_year(register_id, students, oun, s)
return JsonResponse(year_stats)
else:
return redirect('../')
def log_out(request, *args, **kwargs):
del request.session[request.session.session_key]
del request.session['is_logged']

File diff suppressed because it is too large Load diff

View file

@ -1,5 +1,5 @@
var cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'));
students = cookies_data.data.register_r.data;
students = cookies_data.data.students.data;
const displayData = () => {
var primary = '';
@ -28,7 +28,7 @@ const logIn = () => {
studentName = ele[i].value;
students.forEach((student) => {
if (student.UczenPelnaNazwa == studentName) {
cookies_data.data.register_r.data = [student];
cookies_data.data.students.data = [student];
sessionStorage.setItem('cookies_data', JSON.stringify(cookies_data));
window.location.href = '/content/';
}

View file

@ -1,10 +1,22 @@
const attendance_ = document.querySelector('#attendance_');
myStorage = window.sessionStorage;
weekAttendance = 0
const getAttendance = () => {
const getAttendance = (event) => {
if (event.target.id == 'previous-attendance' || event.target.id == 'previous-attendance_i') {
weekAttendance -= 1
}
else if (event.target.id == 'next-attendance' || event.target.id == 'next-attendance_i') {
weekAttendance += 1
}
document.querySelector('#content').innerHTML = 'Here is attendance (in my imagination)';
cookies_data = sessionStorage.getItem('cookies_data');
document.querySelector('#content').innerHTML += '<button id="previous-attendance" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-attendance_i">keyboard_arrow_left</i></button>';
document.querySelector('#content').innerHTML += '<button id="next-attendance" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-attendance_i">keyboard_arrow_right</i></button>';
const left_attendance_ = document.querySelector('#previous-attendance');
const right_attendance_ = document.querySelector('#next-attendance');
left_attendance_.addEventListener('click', getAttendance);
right_attendance_.addEventListener('click', getAttendance);
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/attendance', {
method: 'POST',
@ -13,7 +25,7 @@ const getAttendance = () => {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
body: JSON.stringify({"cookies": cookies_data, "week": weekAttendance})
}).then(response => response.json()).then(data => {
console.log(data);
})

View file

@ -1,9 +1,22 @@
const exams_ = document.querySelector('#exams_');
myStorage = window.sessionStorage;
weekExams = 0
const getExams = () => {
const getExams = (event) => {
if (event.target.id == 'previous-exams' || event.target.id == 'previous-exams_i') {
weekExams -= 1
}
else if (event.target.id == 'next-exams' || event.target.id == 'next-exams_i') {
weekExams += 1
}
document.querySelector('#content').innerHTML = 'Here is exams (in my imagination)';
document.querySelector('#content').innerHTML += '<button id="previous-exams" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-exams_i">keyboard_arrow_left</i></button>';
document.querySelector('#content').innerHTML += '<button id="next-exams" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-exams_i">keyboard_arrow_right</i></button>';
const left_exams_ = document.querySelector('#previous-exams');
const right_exams_ = document.querySelector('#next-exams');
left_exams_.addEventListener('click', getExams);
right_exams_.addEventListener('click', getExams);
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/exams', {
@ -13,7 +26,7 @@ const getExams = () => {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
body: JSON.stringify({"cookies": cookies_data, "week": weekExams})
}).then(response => response.json()).then(data => {
console.log(data)
})

View file

@ -1,9 +1,22 @@
const homeworks_ = document.querySelector('#homeworks_');
myStorage = window.sessionStorage;
weekHomeworks = 0
const getHomeworks = () => {
const getHomeworks = (event) => {
if (event.target.id == 'previous-homeworks' || event.target.id == 'previous-homeworks_i') {
weekHomeworks -= 1
}
else if (event.target.id == 'next-homeworks' || event.target.id == 'next-homeworks_i') {
weekHomeworks += 1
}
document.querySelector('#content').innerHTML = 'Here is homeworks (in my imagination)';
document.querySelector('#content').innerHTML += '<button id="previous-homeworks" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-homeworks_i">keyboard_arrow_left</i></button>';
document.querySelector('#content').innerHTML += '<button id="next-homeworks" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-homeworks_i">keyboard_arrow_right</i></button>';
const left_homeworks_ = document.querySelector('#previous-homeworks');
const right_homeworks_ = document.querySelector('#next-homeworks');
left_homeworks_.addEventListener('click', getHomeworks);
right_homeworks_.addEventListener('click', getHomeworks);
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/homeworks', {
@ -13,7 +26,7 @@ const getHomeworks = () => {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
body: JSON.stringify({"cookies": cookies_data, "week": weekHomeworks})
}).then(response => response.json()).then(data => {
console.log(data);
})

View file

@ -5,7 +5,7 @@ myStorage = window.sessionStorage;
const studentName = () => {
const cookies_data = JSON.parse(sessionStorage.getItem('cookies_data'))
name_.innerHTML = cookies_data['data']['register_r']['data'][0]['UczenImie']+' '+cookies_data['data']['register_r']['data'][0]['UczenImie2']+' '+cookies_data['data']['register_r']['data'][0]['UczenNazwisko']
name_.innerHTML = cookies_data['data']['students']['data'][0]['UczenImie']+' '+cookies_data['data']['students']['data'][0]['UczenImie2']+' '+cookies_data['data']['students']['data'][0]['UczenNazwisko']
};
const studentEmail = () => {

View file

@ -0,0 +1,46 @@
const stats_ = document.querySelector('#stats_');
myStorage = window.sessionStorage;
const showMenu = () => {
document.querySelector('#content').innerHTML = '<button id="partial" class="waves-light waves-effect btn red darken-1">OCENY CZĄSTKOWE</button>';
document.querySelector('#content').innerHTML += '<button id="year" class="waves-light waves-effect btn red darken-1">OCENY ROCZNE</button>';
const partial_ = document.querySelector('#partial');
const year_ = document.querySelector('#year');
partial_.addEventListener('click', getPartial);
year_.addEventListener('click', getYear);
}
const getPartial = () => {
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/stats/partial', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(response => response.json()).then(data => {
console.log(data)
})
}
const getYear = () => {
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/stats/year', {
method: 'POST',
mode: 'cors',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
}).then(response => response.json()).then(data => {
console.log(data)
})
}
stats_.addEventListener('click', showMenu);

View file

@ -1,9 +1,22 @@
const timetable_ = document.querySelector('#timetable_');
myStorage = window.sessionStorage;
weekTimetable = 0
const getTimetable = () => {
const getTimetable = (event) => {
if (event.target.id == 'previous-timetable' || event.target.id == 'previous-timetable_i') {
weekTimetable -= 1
}
else if (event.target.id == 'next-timetable' || event.target.id == 'next-timetable_i') {
weekTimetable += 1
}
document.querySelector('#content').innerHTML = 'Here is timetable (in my imagination)';
document.querySelector('#content').innerHTML += '<button id="previous-timetable" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="previous-timetable_i">keyboard_arrow_left</i></button>';
document.querySelector('#content').innerHTML += '<button id="next-timetable" class="waves-light waves-effect btn red darken-1"><i class="material-icons" id="next-timetable_i">keyboard_arrow_right</i></button>';
const left_timetable_ = document.querySelector('#previous-timetable');
const right_timetable_ = document.querySelector('#next-timetable');
left_timetable_.addEventListener('click', getTimetable);
right_timetable_.addEventListener('click', getTimetable);
cookies_data = sessionStorage.getItem('cookies_data');
csrfcookie_ = sessionStorage.getItem('csrfcookie');
fetch(url = '../api/timetable', {
@ -13,7 +26,7 @@ const getTimetable = () => {
'Content-Type': 'application/json',
'X-CSRFToken': csrfcookie_
},
body: cookies_data
body: JSON.stringify({"cookies": cookies_data, "week": weekTimetable})
}).then(response => response.json()).then(data => {
console.log(data)
})

View file

@ -11,7 +11,84 @@
<body>
<div id="content">
<<<<<<< HEAD
</div>
<script src={% static 'frontend/content.js' %}></script>
=======
<div class="gradeModals"></div> <!-- please don't touch it for scraping, you have an api :D -->
<nav>Wulkanowy web early access insider preview pre-alpha pre-beta alpha beta release canditate v. 0.0.1<div id='log_out_' class='log-out'>Wyloguj</div></nav>
<ul id="slide-out" class="sidenav">
<li><div class="user-view">
<div class="background">
<img src="{% static 'frontend/images/wallpaper.jpg' %}" width="300" height="176">
</div>
<a><img class="circle" src="{% static 'frontend/images/27146352.png' %}"></a>
<a><span class="white-text name" id='name'>Imie Imie2 Nazwisko</span></a>
<a><span class="white-text email" id='email'>E-mail</span></a>
</div></li>
<li><a id="dashboard_" class='option'><i class="material-icons">dashboard</i>Start</a></li>
<li><a id="grades_" class='option'><i class="material-icons">filter_6</i>Oceny</a></li>
<li><a id="timetable_" class='option'><i class="material-icons">event_note</i>Plan Lekcji</a></li>
<li><a id="exams_" class='option'><i class="material-icons">event</i>Sprawdziany</a></li>
<li><a id="homeworks_" class='option'><i class="material-icons">class</i>Zadania Domowe</a></li>
<li><a id="attendance_" class='option'><i class="material-icons">date_range</i>Frekwencja</a></li>
<li><a id="stats_" class='option'><i class="material-icons">insert_chart_outlined</i>Uczeń na Tle Klasy</a></li>
<li><a id="notes_" class='option'><i class="material-icons">emoji_events</i>Uwagi i Osiągnięcia</a></li>
<li><a id="mobile_access_" class='option'><i class="material-icons">devices</i>Dostęp Mobilny</a></li>
<li><a id="school_data_" class='option'><i class="material-icons">business</i>Szkoła i Nauczyciele</a></li>
<li><a id="student_data_" class='option'><i class="material-icons">assignment_ind</i>Dane Ucznia</a></li>
<li><a id="messages_" class="dropdown-trigger" data-target="dropdown1"><i class="material-icons">email</i>Wiadomości</a></li>
<ul id='dropdown1' class='dropdown-content'>
<li><a id='received_' class='option'>Odebrane</a></li>
<li><a id='sent_' class='option'>Wysłane</a></li>
<li><a id='send_' class='option'>Napisz Wiadomość</a></li>
<li><a id='deleted_' class='option'>Usunięte</a></li>
</ul>
</ul>
<a href="#" data-target="slide-out" class="sidenav-trigger"><i class="material-icons">menu</i></a>
<div id="content">
</div>
</div>
<script>
var elem = document.querySelector('.tabs');
var options = {}
var instance = M.Tabs.init(elem, options);
// sidebar
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.sidenav');
var instances = M.Sidenav.init(elems, options);
});
// modal
document.addEventListener('DOMContentLoaded', function() {
var elems = document.querySelectorAll('.modal');
var instances = M.Modal.init(elems, options);
});
var dropdowns = document.querySelectorAll('.dropdown-trigger')
for (var i = 0; i < dropdowns.length; i++){
M.Dropdown.init(dropdowns[i]);
}
</script>
<script src="{% static 'frontend/js/start.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dashboard.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dist/out-grades.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/timetable.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/exams.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/notes.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/attendance.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/homeworks.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/dist/out-messages.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/mobile_access.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/school_data.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/student_data.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/stats.js' %}" type="text/javascript" defer></script>
<script src="{% static 'frontend/js/log-out.js' %}" type="text/javascript" defer></script>
>>>>>>> master
</body>
</html>

Binary file not shown.

View file

@ -1,5 +1,6 @@
cd frontend
start npm run watch
start npm run dev
cd ..
cls
cd ..
python manage.py runserver

View file

@ -57,19 +57,19 @@ def get_data_test(client, cookies_data, assertEquals):
assertEquals(response.status_code, 200)
#TIMETABLE
response = client.post(reverse('timetable'), content_type='application/xml', data=json.dumps(cookies_data))
response = client.post(reverse('timetable'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
assertEquals(response.status_code, 200)
#EXAMS
response = client.post(reverse('exams'), content_type='application/xml', data=json.dumps(cookies_data))
response = client.post(reverse('exams'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
assertEquals(response.status_code, 200)
#HOMEWORKS
response = client.post(reverse('homeworks'), content_type='application/xml', data=json.dumps(cookies_data))
response = client.post(reverse('homeworks'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
assertEquals(response.status_code, 200)
#ATTENDANCE
response = client.post(reverse('attendance'), content_type='application/xml', data=json.dumps(cookies_data))
response = client.post(reverse('attendance'), content_type='application/xml', data=json.dumps({'cookies': json.dumps(cookies_data), 'week': 0}))
assertEquals(response.status_code, 200)
#NOTES
@ -120,6 +120,15 @@ def get_data_test(client, cookies_data, assertEquals):
response = client.post(reverse('student_data'), content_type='application/xml', data=json.dumps(cookies_data))
assertEquals(response.status_code, 200)
#STATS
#PARTIAL
response = client.post(reverse('partial'), content_type='application/xml', data=json.dumps(cookies_data))
assertEquals(response.status_code, 200)
#YEAR
response = client.post(reverse('year'), content_type='application/xml', data=json.dumps(cookies_data))
assertEquals(response.status_code, 200)
#SEND MESSAGE
for recipient in recipients:
send_data = {

View file

@ -17,14 +17,14 @@ from django.urls import path
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from frontend.views import default_view, content_view, account_manager_view
from app.views import login, grades, timetable, exams, homeworks, attendance, notes, registered_devices, register_device_, received_messages, sent_messages, deleted_messages, school_data, dashboard, recipients, send, message_content, student_data, log_out
from app.views import login, grades, timetable, exams, homeworks, attendance, notes, registered_devices, register_device_, received_messages, sent_messages, deleted_messages, school_data, dashboard, recipients, send, message_content, student_data, log_out, partial, year
urlpatterns = [
#views
path('', default_view, name='home'),
path('content/', content_view, name='content'),
path('account-manager/', account_manager_view, name='account_manager'),
#api
#API
path('api/login', login, name='login'),
path('api/grades', grades, name='grades'),
path('api/timetable', timetable, name='timetable'),
@ -36,6 +36,9 @@ urlpatterns = [
path('api/dashboard', dashboard, name='dashboard'),
path('api/student_data', student_data, name='student_data'),
path('api/log_out', log_out, name='log_out'),
#STATS
path('api/stats/partial', partial, name='partial'),
path('api/stats/year', year, name='year'),
#MOBILE ACCESS
path('api/mobile/registered', registered_devices, name='registered_devices'),
path('api/mobile/register', register_device_, name='register_device'),