commit
f40783a229
7 changed files with 278 additions and 2 deletions
@ -0,0 +1,48 @@ |
|||||||
|
# Получить список файлов папки reports |
||||||
|
# Выдать выбор отчета |
||||||
|
# Запустить файл |
||||||
|
import os |
||||||
|
import sys |
||||||
|
|
||||||
|
BASEDIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) |
||||||
|
REPORTS = '/var/www/projects/codemy/_utils/reports' |
||||||
|
|
||||||
|
|
||||||
|
class CL: |
||||||
|
def __init__(self): |
||||||
|
print('# Система отчетов') |
||||||
|
print('=======================') |
||||||
|
print('Дирректория отчетов: {0}'.format(REPORTS)) |
||||||
|
self.files = self.get_files_list() |
||||||
|
|
||||||
|
def get_files_list(self): |
||||||
|
# Получение рабочих файлов дирректории |
||||||
|
__tmp = [] |
||||||
|
for p, dir, files in os.walk(REPORTS): |
||||||
|
for f in files: |
||||||
|
if f.endswith('.py') and f != '__init__.py': |
||||||
|
__tmp.append(os.path.join(p, f)) |
||||||
|
return __tmp |
||||||
|
|
||||||
|
def choise_report(self): |
||||||
|
# Выбрать отчет |
||||||
|
print('Выберите отчет') |
||||||
|
_n = 0 |
||||||
|
for _t in self.files: |
||||||
|
print('{0}: {1}'.format(_n, _t)) |
||||||
|
_n += 1 |
||||||
|
_ch = input('Ваш выбор: ') |
||||||
|
if _ch == '-': |
||||||
|
sys.exit(0) |
||||||
|
else: |
||||||
|
os.system('python {0}'.format(os.path.join(REPORTS, self.files[int(_ch)]))) |
||||||
|
|
||||||
|
|
||||||
|
def main(): |
||||||
|
CL().choise_report() |
||||||
|
print('========') |
||||||
|
print('Работа закончена. Удачи.') |
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__': |
||||||
|
main() |
||||||
@ -0,0 +1,34 @@ |
|||||||
|
# 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 |
||||||
|
|
||||||
|
_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('======') |
||||||
|
|
||||||
|
# Получить количество ДЗ в статусе прохождения |
||||||
|
_homeworks = HomeworkJ.objects.filter(f_date=None, parent__parent__in=_journals).exclude(date=None) |
||||||
|
print('ДЗ в статусе прохождения: {0}'.format(_homeworks.count())) |
||||||
|
|
||||||
|
for i in CourseTheme.objects.filter(course=_course).order_by('sort'): |
||||||
|
print('{0}: {2} [{1}]'.format(i.sort, i.get_title(), HomeworkJ.objects.filter(f_date=None, parent__material=i).exclude(date=None).count())) |
||||||
@ -0,0 +1,31 @@ |
|||||||
|
# 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() |
||||||
|
|
||||||
|
from finance.models import Bill |
||||||
|
from django.db.models import Q |
||||||
|
|
||||||
|
packs = [67, 66, 64, 65, 68, 69] |
||||||
|
print('## Скольким пользователям было продано более, чем 1 курс. Исключая пакеты.') |
||||||
|
print('Всего оплаченых счетов: {0}'.format(Bill.objects.filter(status='F', user__in_role='U').exclude(Q(service__id__in=packs) | |
||||||
|
Q(service__course=None)).count())) |
||||||
|
|
||||||
|
_u = {} |
||||||
|
for _b in Bill.objects.filter(status='F', user__in_role='U').exclude(service__id__in=packs): |
||||||
|
if _u.get(_b.user.email): |
||||||
|
_u[_b.user.email] += 1 |
||||||
|
else: |
||||||
|
_u[_b.user.email] = 1 |
||||||
|
|
||||||
|
_c = 0 |
||||||
|
|
||||||
|
for k, v in _u.items(): |
||||||
|
if v > 1: |
||||||
|
_c += 1 |
||||||
|
|
||||||
|
print('Повторных счетов: {0}'.format(_c)) |
||||||
@ -0,0 +1,144 @@ |
|||||||
|
{% extends 'base_index.html' %} |
||||||
|
{% block title %}Кабинет преподавателя{% endblock %} |
||||||
|
{% block head %} |
||||||
|
<script> |
||||||
|
window.hw_length = 0; |
||||||
|
window.ex_length = 0; |
||||||
|
</script> |
||||||
|
{% endblock %} |
||||||
|
{% block asside %} |
||||||
|
<aside id="aside" class="app-aside hidden-xs bg-dark" style="background: #3a3f51;"> |
||||||
|
<div class="aside-wrap"> |
||||||
|
<div class="navi-wrap"> |
||||||
|
<!-- user --> |
||||||
|
<div class="clearfix hidden-xs text-center" id="aside-user"> |
||||||
|
<div class="dropdown wrapper"> |
||||||
|
<a href="/teacher/profile/"> |
||||||
|
<span class="thumb-lg w-auto-folded avatar m-t-sm"> |
||||||
|
<img src="{{ request.user.get_image_url }}" class="img-full" style="width: 100%;" reloader_name="avatar"> |
||||||
|
</span> |
||||||
|
</a> |
||||||
|
<a href="#"> |
||||||
|
<span class="clear"> |
||||||
|
<span class="block m-t-sm"> |
||||||
|
<strong class="font-bold text-lt">{{ request.user.get_short_name }}</strong> |
||||||
|
</span> |
||||||
|
<span class="text-muted text-xs block">{{ request.user.get_role_display }}</span> |
||||||
|
</span> |
||||||
|
</a> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!-- / user --> |
||||||
|
<a href="/teacher/history"> |
||||||
|
<div style=" padding: 10px 20px; |
||||||
|
background: #f1f1f1; |
||||||
|
text-align: center; |
||||||
|
font-weight: bold; |
||||||
|
font-size: 16px;"> |
||||||
|
Архив работ |
||||||
|
|
||||||
|
</div></a> |
||||||
|
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true"> |
||||||
|
{% for i in courses %} |
||||||
|
<div class="panel panel-default" style="border-radius: 0; border: 0; margin-bottom: 20px;"> |
||||||
|
<div class="panel-heading" role="tab" id="heading{{ i.id }}" style="padding: 15px;border-radius: 0; |
||||||
|
background: #333; border-bottom: 3px solid #000;"> |
||||||
|
<span class="panel-title" style=" font-size: 16px; |
||||||
|
font-weight: bold; |
||||||
|
color: #fff;"> |
||||||
|
|
||||||
|
<a role="button" data-toggle="collapse" data-parent="#accordion" |
||||||
|
href="#collapseOne_{{ i.id }}" aria-expanded="true" style="color: #fff;" |
||||||
|
aria-controls="collapseOne"> |
||||||
|
{{ i.title }} |
||||||
|
</a> |
||||||
|
|
||||||
|
</span> |
||||||
|
</div> |
||||||
|
<div id="collapseOne_{{ i.id }}" class="panel-collapse collapse {% if course.id == i.id %}in{% endif %}" role="tabpanel" aria-labelledby="heading{{ i.id }}"> |
||||||
|
<div class="panel-body" style="padding: 0;border: 0;"> |
||||||
|
<ul class="nav" style="background: #3a3f51;"> |
||||||
|
<li {% if i.id == course.id and T == 'H' %}class="active"{% endif %}> |
||||||
|
<a href="/teacher/homeworks/{{ i.id }}" class="auto prepod_nav_item"> |
||||||
|
<i class=" fa fa-check-square-o text-warning-dk pull-left"></i><b class="label bg-warning c-gray" style="margin-left: 5px;">{{ i.get_students_on_homework_length }}</b><Br> |
||||||
|
Домашние задания |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<li {% if i.id == course.id and T == 'E' %}class="active"{% endif %}> |
||||||
|
<a href="/teacher/exams/{{ i.id }}" class="auto prepod_nav_item"> |
||||||
|
<i class=" fa fa-check-square-o text-warning-dk pull-left"></i> |
||||||
|
<b class="label bg-warning c-gray" style="margin-left: 5px;">{{ i.get_active_exam_students_length }}</b><Br> |
||||||
|
Сдача экзаменов |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
<!-- |
||||||
|
<li> |
||||||
|
<a href="/teacher/comments/{{ i.id }}" class="auto prepod_nav_item"> |
||||||
|
<i class=" fa fa-comments-o text-warning-dk pull-left"></i><b class="label bg-warning c-gray" style="margin-left: 5px;">{{ i.get_no_saw_lessons_length }}</b><Br> |
||||||
|
Комментарии к видео |
||||||
|
</a> |
||||||
|
</li>--> |
||||||
|
<li {% if i.id == course.id and T == 'M' %}class="active"{% endif %}> |
||||||
|
<a href="/teacher/materials/{{ i.id }}" class="prepod_nav_item"> |
||||||
|
<i class="icon-grid icon text-warning-dk pull-left"></i><Br> |
||||||
|
Материалы курсы |
||||||
|
</a> |
||||||
|
</li> |
||||||
|
|
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endfor %} |
||||||
|
|
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!-- nav --> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</aside> |
||||||
|
{% endblock %} |
||||||
|
<!-- / aside --> |
||||||
|
|
||||||
|
<!-- content --> |
||||||
|
{% block content %} |
||||||
|
<div class="col"> |
||||||
|
<!-- main header --> |
||||||
|
<div class="wrapper-md"> |
||||||
|
<div class="row"> |
||||||
|
<table style="width: 100%;"> |
||||||
|
<tbody> |
||||||
|
<tr> |
||||||
|
<td style="text-align: center;font-weight:bold;background: #fff; padding: 5px;">Тема</td> |
||||||
|
<td style="text-align: center;font-weight:bold;background: #fff;padding: 5px;">Студент</td> |
||||||
|
<td style="text-align: center;font-weight:bold;background: #fff;padding: 5px;">Дата открытия</td> |
||||||
|
<td style="text-align: center;font-weight:bold;background: #fff;padding: 5px;">Дата сдачи</td> |
||||||
|
</tr> |
||||||
|
{% for h in hw %} |
||||||
|
<tr> |
||||||
|
<td style="padding: 10px;"> |
||||||
|
<a href="/teacher/workshop/homework/{{ h.id }}" target="_blank" |
||||||
|
style="border-bottom: 1px dotted;color:#337ab7;"> |
||||||
|
{{ h.material.get_title }} |
||||||
|
</a> |
||||||
|
</td> |
||||||
|
<td> |
||||||
|
<a href="/{{ h.student.interactive_key }}" target="_blank"> |
||||||
|
{{ h.student }} |
||||||
|
</a> |
||||||
|
</td> |
||||||
|
<td>{{ h.date }}</td> |
||||||
|
<td>{{ h.f_date }}</td> |
||||||
|
</tr> |
||||||
|
{% endfor %} |
||||||
|
</tbody> |
||||||
|
</table> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<!-- / main header --> |
||||||
|
|
||||||
|
</div> |
||||||
|
<!-- / main --> |
||||||
|
<!-- right col --> |
||||||
|
{% include 'right_site.html' %} |
||||||
|
<!-- / right col --> |
||||||
|
{% endblock %} |
||||||
Loading…
Reference in new issue