|
|
|
|
@ -421,12 +421,16 @@ class CourseThemeJ(models.Model): |
|
|
|
|
self.actual_lesson = Lesson.objects.get(id=self.make_actual_lesson()) |
|
|
|
|
|
|
|
|
|
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) |
|
|
|
|
|