|
|
|
|
@ -55,21 +55,7 @@ def course(request, slug): |
|
|
|
|
journal.start_date = datetime.datetime.now() |
|
|
|
|
journal.save() |
|
|
|
|
|
|
|
|
|
waiting_materials = [] |
|
|
|
|
if journal.waiting.exists(): |
|
|
|
|
for n in journal.waiting.all(): |
|
|
|
|
_obj = n.get_obj() |
|
|
|
|
__type = n.get_type() |
|
|
|
|
_type = None |
|
|
|
|
if __type == 'L': |
|
|
|
|
_type = 'lesson' |
|
|
|
|
elif __type == 'H': |
|
|
|
|
_type = 'homework' |
|
|
|
|
elif __type == 'E': |
|
|
|
|
_type = 'exam' |
|
|
|
|
|
|
|
|
|
waiting_materials.append({'obj': _obj, 'type': _type}) |
|
|
|
|
return {'course': journal.get_face(user_fabric(request.user)), 'user': user_fabric(request.user), 'waiting_materials': waiting_materials} |
|
|
|
|
return {'course': journal.get_face(user_fabric(request.user)), 'user': user_fabric(request.user)} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@response_decor(template='lesson.html') |
|
|
|
|
@ -86,27 +72,12 @@ def lesson(request, lesson): |
|
|
|
|
check_journal(j) |
|
|
|
|
lj = LessonJ.objects.get(material=lesson, student=request.user) |
|
|
|
|
|
|
|
|
|
waiting_materials = [] |
|
|
|
|
if lj.parent.parent.waiting.exists(): |
|
|
|
|
for n in lj.parent.parent.waiting.all(): |
|
|
|
|
_obj = n.get_obj() |
|
|
|
|
__type = n.get_type() |
|
|
|
|
_type = None |
|
|
|
|
if __type == 'L': |
|
|
|
|
_type = 'lesson' |
|
|
|
|
elif __type == 'H': |
|
|
|
|
_type = 'homework' |
|
|
|
|
elif __type == 'E': |
|
|
|
|
_type = 'exam' |
|
|
|
|
|
|
|
|
|
waiting_materials.append({'obj': _obj, 'type': _type}) |
|
|
|
|
|
|
|
|
|
if request.user.is_authenticated() and request.user.is_admin or request.user in lesson.course.teachers.all(): |
|
|
|
|
return {'lesson': lj.get_face(user_fabric(request.user)), |
|
|
|
|
'course': {'head': lj.parent.parent.get_head_face(), |
|
|
|
|
'level': lj.parent.parent.course.get_level(), |
|
|
|
|
'journal': lj.parent.parent.get_face(user_fabric(request.user))}, |
|
|
|
|
'bought': True, 'accept': True, 'waiting_materials': waiting_materials} |
|
|
|
|
'bought': True, 'accept': True} |
|
|
|
|
|
|
|
|
|
if not lesson.free and not system_check_bill(lesson.token, request.user, theme_type=lesson.theme._type): |
|
|
|
|
return {'redirect': '/access/by_error/'} |
|
|
|
|
@ -122,7 +93,7 @@ def lesson(request, lesson): |
|
|
|
|
lj.date = datetime.datetime.now() |
|
|
|
|
lj.save() |
|
|
|
|
if result: |
|
|
|
|
return {'lesson': lj.get_face(user_fabric(request.user)), 'course': {'head': lj.parent.parent.get_head_face(), 'level': lj.parent.parent.course.get_level(), 'journal': lj.parent.parent.get_face(user_fabric(request.user))}, 'bought': True, 'accept': True, 'waiting_materials': waiting_materials} |
|
|
|
|
return {'lesson': lj.get_face(user_fabric(request.user)), 'course': {'head': lj.parent.parent.get_head_face(), 'level': lj.parent.parent.course.get_level(), 'journal': lj.parent.parent.get_face(user_fabric(request.user))}, 'bought': True, 'accept': True} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@response_decor(template='homework.html') |
|
|
|
|
@ -138,27 +109,12 @@ def homework(request, homework): |
|
|
|
|
check_journal(j) |
|
|
|
|
hj = HomeworkJ.objects.get(material=Homework.objects.get(id=homework), student=request.user) |
|
|
|
|
|
|
|
|
|
waiting_materials = [] |
|
|
|
|
if hj.parent.parent.waiting.exists(): |
|
|
|
|
for n in hj.parent.parent.waiting.all(): |
|
|
|
|
_obj = n.get_obj() |
|
|
|
|
__type = n.get_type() |
|
|
|
|
_type = None |
|
|
|
|
if __type == 'L': |
|
|
|
|
_type = 'lesson' |
|
|
|
|
elif __type == 'H': |
|
|
|
|
_type = 'homework' |
|
|
|
|
elif __type == 'E': |
|
|
|
|
_type = 'exam' |
|
|
|
|
|
|
|
|
|
waiting_materials.append({'obj': _obj, 'type': _type}) |
|
|
|
|
|
|
|
|
|
if request.user.is_authenticated() and request.user.is_admin: |
|
|
|
|
return {'homework': hj.get_face(user_fabric(request.user)), |
|
|
|
|
'course': {'head': hj.parent.parent.get_head_face(), |
|
|
|
|
'level': hj.parent.parent.course.get_level(), |
|
|
|
|
'journal': hj.parent.parent.get_face(user_fabric(request.user))}, |
|
|
|
|
'waiting_materials': waiting_materials} |
|
|
|
|
'journal': hj.parent.parent.get_face(user_fabric(request.user))} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if not system_check_bill(hj.material.token, request.user, theme_type=hj.material.theme._type): |
|
|
|
|
return {'redirect': '/access/by_error/'} |
|
|
|
|
@ -177,8 +133,7 @@ def homework(request, homework): |
|
|
|
|
if result: |
|
|
|
|
return {'homework': hj.get_face(user_fabric(request.user)), |
|
|
|
|
'course': {'head': hj.parent.parent.get_head_face(), |
|
|
|
|
'level': hj.parent.parent.course.get_level(), 'journal': hj.parent.parent.get_face(user_fabric(request.user))}, |
|
|
|
|
'waiting_materials': waiting_materials} |
|
|
|
|
'level': hj.parent.parent.course.get_level(), 'journal': hj.parent.parent.get_face(user_fabric(request.user))},} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@response_decor(template='exam.html') |
|
|
|
|
@ -194,25 +149,10 @@ def exam(request, exam): |
|
|
|
|
check_journal(j) |
|
|
|
|
exam = ExamJ.objects.get(material=Exam.objects.get(id=exam), student=request.user) |
|
|
|
|
|
|
|
|
|
waiting_materials = [] |
|
|
|
|
if exam.parent.parent.waiting.all().exists(): |
|
|
|
|
for n in exam.parent.parent.waiting.all(): |
|
|
|
|
_obj = n.get_obj() |
|
|
|
|
__type = n.get_type() |
|
|
|
|
_type = None |
|
|
|
|
if __type == 'L': |
|
|
|
|
_type = 'lesson' |
|
|
|
|
elif __type == 'H': |
|
|
|
|
_type = 'homework' |
|
|
|
|
elif __type == 'E': |
|
|
|
|
_type = 'exam' |
|
|
|
|
|
|
|
|
|
waiting_materials.append({'obj': _obj, 'type': _type}) |
|
|
|
|
|
|
|
|
|
if request.user.is_authenticated() and request.user.is_admin: |
|
|
|
|
return {'exam': exam.get_face(user_fabric(request.user)), |
|
|
|
|
'course': {'head': exam.parent.parent.get_head_face(), 'level': exam.parent.parent.course.get_level()}, |
|
|
|
|
'waiting_materials': waiting_materials} |
|
|
|
|
'course': {'head': exam.parent.parent.get_head_face(), 'level': exam.parent.parent.course.get_level()} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if not system_check_bill(exam.material.token, request.user): |
|
|
|
|
return {'redirect': '/access/by_error/'} |
|
|
|
|
@ -229,7 +169,7 @@ def exam(request, exam): |
|
|
|
|
exam.save() |
|
|
|
|
|
|
|
|
|
if result: |
|
|
|
|
return {'exam': exam.get_face(user_fabric(request.user)), 'course': {'head': exam.parent.parent.get_head_face(), 'level': exam.parent.parent.course.get_level()}, 'waiting_materials': waiting_materials} |
|
|
|
|
return {'exam': exam.get_face(user_fabric(request.user)), 'course': {'head': exam.parent.parent.get_head_face(), 'level': exam.parent.parent.course.get_level()}} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@response_decor(template='all_achievements.html', without_auth=True) |
|
|
|
|
|