diff --git a/_utils/check_course_journal.py b/_utils/check_course_journal.py index e701d2c..a82cc7b 100644 --- a/_utils/check_course_journal.py +++ b/_utils/check_course_journal.py @@ -59,4 +59,5 @@ def check_course_journal(course_id): if __name__ == "__main__": course_id = sys.argv[1] - check_course_journal(course_id) \ No newline at end of file + check_course_journal(course_id) + diff --git a/courses/views.py b/courses/views.py index 19494fa..e34e266 100755 --- a/courses/views.py +++ b/courses/views.py @@ -45,9 +45,9 @@ def course(request, slug): if created: check_journal(journal) _map = CourseMap.objects.filter(course=course).order_by('sort').first() - _j = _map.get_obj() - j = HomeworkJ.objects.get(material=_j, student=request.user) - j.open_material() + #_j = _map.get_obj() + #j = HomeworkJ.objects.get(material=_j, student=request.user) + #j.open_material() else: journal, created = TeacherJ.objects.get_or_create(course=course, student=user_fabric(request.user)) diff --git a/journals/models.py b/journals/models.py index e8ad133..a1845f2 100755 --- a/journals/models.py +++ b/journals/models.py @@ -433,12 +433,16 @@ class CourseThemeJ(models.Model): self.success = True if self.set_open: - if self.material._type != 'Ex' and self.actual_lesson and not self.parent.opens.filter( - id=CourseMap.objects.get(token=self.actual_lesson.token).id).exists(): - set_opened(self.parent, self.actual_lesson.token) + if Lesson.objects.filter(theme=self.material).order_by('sort').exists(): + lesson = Lesson.objects.filter(theme=self.material).order_by('sort')[0] + else: + lesson = CourseMap.objects.filter(course=self.material.course).order_by('-sort')[0] + + if self.material._type != 'Ex' and not self.parent.opens.filter(token=lesson.token).exists(): + self.parent.opens.add(CourseMap.objects.get(token=lesson.token)) + set_opened(self.parent, lesson.token) - elif self.material._type == 'Ex' and not self.parent.opens.filter( - id=CourseMap.objects.get(token=Exam.objects.get(theme=self.material).token).id).exists(): + elif self.material._type == 'Ex' and not self.parent.opens.filter(id=CourseMap.objects.get(token=Exam.objects.get(theme=self.material).token).id).exists(): set_opened(self.parent, Exam.objects.get(theme=self.material).token) super(CourseThemeJ, self).save(*args, **kwargs) diff --git a/lms/settings.py b/lms/settings.py index a39fb90..6129997 100644 --- a/lms/settings.py +++ b/lms/settings.py @@ -56,12 +56,12 @@ BILL_TOKEN = u'c63fc7fdc74de318e1f9b078b6d4406a3e62f522b00fb305afe61c0ead238eb9c AMO_USER_LOGIN = 'baryshnikov@mokselle.com' AMO_USER_HASH = 'd639c26c1c1900e5a8cee66cd3395bdc' AMO_SUBDOMAIN = 'mokselle' -EMAIL_HOST = 'smtp.yandex.ru' +EMAIL_HOST = 'smtp.gmail.com' EMAIL_HOST_PASSWORD = 'nu5Xefise' -EMAIL_HOST_USER = 'robo@skill-box.ru' +EMAIL_HOST_USER = 'robo@skillbox.ru' EMAIL_PORT = '587' EMAIL_USE_TLS = True -DEFAULT_FROM_EMAIL = 'robo@skill-box.ru' +DEFAULT_FROM_EMAIL = 'robo@skillbox.ru' YANDEX_MONEY_SHOP_PASSWORD = 'nu5Xefise' YANDEX_SHOP_ID = '84348' YANDEX_scid = '78309' diff --git a/management/letters.py b/management/letters.py index 379d8e3..7006cbf 100755 --- a/management/letters.py +++ b/management/letters.py @@ -248,7 +248,6 @@ def sent_new_bill(bill): 'SERVICE': bill.get_name(), 'MANAGER': bill.manager.get_full_name(), 'MANAGER_EMAIL': bill.manager.get_email(), - 'FILE': None, #TODO: bill.service.course.get_description_file, 'DOMAIN': DOMAIN, 'NAME': NAME } diff --git a/management/mails.py b/management/mails.py index a95b031..4f18001 100755 --- a/management/mails.py +++ b/management/mails.py @@ -13,6 +13,6 @@ def letter_decor(): _type=data['type'], template=data['template'] if data.get('template') else '', result=data['result'] if data.get('result') else None, - file=data['file']) + ) return _render_json return wrap_response