You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.3 KiB
41 lines
1.3 KiB
from __future__ import print_function
|
|
import datetime
|
|
# coding=utf-8
|
|
import os
|
|
import django
|
|
import sys
|
|
|
|
sys.path.append("/var/www/projects/lms/")
|
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lms.settings")
|
|
django.setup()
|
|
from access.models import User
|
|
from journals.models import ExamTry, HomeworkTry
|
|
|
|
|
|
def check_robo_prep():
|
|
teacher = User.objects.get(email='t@lms.ru')
|
|
handler = []
|
|
for journal in HomeworkTry.objects.filter(teacher=teacher, f_date=None).exclude(success=True, date=None).order_by('date'):
|
|
if journal.parent.get_status_flag not in ['N', 'F']:
|
|
handler.append(journal)
|
|
|
|
for journal in ExamTry.objects.filter(teacher=teacher, f_date=None).exclude(success=True, date=None).order_by('date'):
|
|
if journal.parent.get_status_flag not in ['N', 'F']:
|
|
handler.append(journal)
|
|
|
|
print(handler)
|
|
for _tr in handler:
|
|
for _cm in _tr.comments.all():
|
|
s = False
|
|
print(_cm.text)
|
|
if 'GO_TO_SUCCESS' in _cm.text:
|
|
_tr.success = True
|
|
_tr.f_date = datetime.datetime.now()
|
|
s = True
|
|
elif 'GO_TO_FAIL' in _cm.text:
|
|
_tr.f_date = datetime.datetime.now()
|
|
s = True
|
|
if s:
|
|
_tr.save()
|
|
|
|
check_robo_prep() |