parent
af0a3df739
commit
986f03c59d
2 changed files with 46 additions and 0 deletions
@ -0,0 +1,45 @@ |
||||
# coding=utf-8 |
||||
import os |
||||
import django |
||||
import sys |
||||
|
||||
sys.path.append("/var/www/projects/codemy/") |
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.settings") |
||||
django.setup() |
||||
print('## Отчет по распределению слушателей по курсу') |
||||
from courses.models import Course, CourseTheme |
||||
from finance.models import Bill |
||||
from journals.models import TeacherJ, HomeworkJ, CourseThemeJ, HomeworkTry |
||||
|
||||
_courses = Course.objects.filter(public=True).order_by('id') |
||||
for _c in _courses: |
||||
print('{0}: {1}'.format(_c.id, _c.get_title())) |
||||
|
||||
_c = input('Выберите курс: ') |
||||
|
||||
_course = Course.objects.get(id=int(_c)) |
||||
print('======') |
||||
print('# Курс: {0}'.format(_course.get_title())) |
||||
print('Оплеченых счетов: {0}'.format(Bill.objects.filter(service__course=_course, status='F').count())) |
||||
_journals = TeacherJ.objects.filter(course=_course, progress__gt=10).exclude(progress=100) |
||||
print('Студентов: {0}'.format(_journals.count())) |
||||
|
||||
print('======') |
||||
|
||||
|
||||
def check_hj(hj): |
||||
if hj: |
||||
if HomeworkTry.objects.filter(parent=hj).exists(): |
||||
return hj |
||||
|
||||
return False |
||||
|
||||
|
||||
for i in CourseTheme.objects.filter(course=_course).order_by('sort'): |
||||
hj = map(check_hj, HomeworkJ.objects.filter(parent__material=i).exclude(f_date=None)) |
||||
_hj = set() |
||||
for r in hj: |
||||
if r: |
||||
_hj.add(r) |
||||
print('{0}: {2} [{1}]'.format(i.sort, i.get_title(), len(_hj))) |
||||
|
||||
Loading…
Reference in new issue