Exemplo n.º 1
0
    def _postpone_child_branch(self, old_gr, new_gr):
        """
        Unlike child leaf, the child branch must also be postponed (recursively)
        """
        old_egy = old_gr.child_branch
        new_egy = old_egy.next_year()

        if not new_egy:
            new_egy = duplicate_education_group_year(old_egy,
                                                     self.next_academic_year)
            self.postpone(old_egy)

        new_gr.child_branch = new_egy
        return new_gr.save()
Exemplo n.º 2
0
    def _duplication_education_group_year(self, old_gr: GroupElementYear, old_egy: EducationGroupYear):
        if old_egy.education_group_type.category != Categories.GROUP.name:
            if old_egy.education_group.end_year and old_egy.education_group.end_year < self.next_academic_year.year:
                self.warnings.append(EducationGroupEndYearWarning(old_egy, self.next_academic_year))
                return None

        new_egy = duplicate_education_group_year(old_egy, self.next_academic_year)

        if old_gr.link_type != LinkTypes.REFERENCE.name:
            # Copy its children
            self._postpone(old_egy, new_egy)
        else:
            self.warnings.append(ReferenceLinkEmptyWarning(new_egy))

        return new_egy
Exemplo n.º 3
0
    def _duplication_education_group_year(self, old_gr: GroupElementYear, old_egy: EducationGroupYear):
        if old_egy.education_group_type.category != Categories.GROUP.name:
            if old_egy.education_group.end_year and old_egy.education_group.end_year < self.next_academic_year.year:
                self.warnings.append(EducationGroupEndYearWarning(old_egy, self.next_academic_year))
                return None

        new_egy = duplicate_education_group_year(old_egy, self.next_academic_year)

        if old_gr.link_type != LinkTypes.REFERENCE.name:
            # Copy its children
            self._postpone(old_egy, new_egy)
        else:
            self.warnings.append(ReferenceLinkEmptyWarning(new_egy))

        return new_egy