Поменял проверку уроков

remotes/origin/pm_task_31703
Mikhail Bortnikov 9 years ago
parent 635f72afeb
commit 21ba623e41
  1. 16
      journals/models.py

@ -414,15 +414,6 @@ class CourseThemeJ(models.Model):
p.save() p.save()
return p return p
def check_lessons(self):
""" Проверка уроков темы на статус. Если сдано - сдана тема"""
for lessonj in LessonJ.objects.filter(parent=self, student=self.student):
if lessonj.success == False:
return False
return True
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if not self.parent: if not self.parent:
self.parent = self.get_parent() self.parent = self.get_parent()
@ -437,8 +428,11 @@ class CourseThemeJ(models.Model):
elif actual_lesson != self.actual_lesson.id: elif actual_lesson != self.actual_lesson.id:
self.actual_lesson = Lesson.objects.get(id=self.make_actual_lesson()) self.actual_lesson = Lesson.objects.get(id=self.make_actual_lesson())
if self.check_lessons(): if LessonJ.objects.filter(parent=self, student=self.student).exists():
self.success = True if LessonJ.objects.filter(parent=self, student=self.student, success=False).exists():
self.success = False
else:
self.success = True
if self.set_open: if self.set_open:
if Lesson.objects.filter(theme=self.material).order_by('sort').exists(): if Lesson.objects.filter(theme=self.material).order_by('sort').exists():

Loading…
Cancel
Save