コード例 #1
0
 def setUpTestData(cls):
     entities = create_entities_hierarchy()
     cls.faculty = entities['child_one_entity_version']
     cls.child_entity = EntityFactory(country=entities['country'],
                                      organization=entities['organization'])
     cls.child_entity_version = EntityVersionFactory(
         acronym="CHILD_1_UNDER_FAC",
         parent=cls.faculty.entity,
         entity_type=SCHOOL,
         end_date=None,
         entity=cls.child_entity,
         start_date=entities['start_date'])
     cls.academic_year = create_current_academic_year()
     cls.education_group = EducationGroupFactory()
     EducationGroupYearFactory(education_group=cls.education_group,
                               academic_year=cls.academic_year,
                               management_entity=cls.child_entity)
     cls.formation = ContinuingEducationTrainingFactory(
         education_group=cls.education_group, )
     cls.admission = AdmissionFactory(formation=cls.formation,
                                      awareness_ucl_website=False,
                                      awareness_formation_website=False,
                                      awareness_press=False,
                                      awareness_facebook=True,
                                      awareness_linkedin=False,
                                      awareness_customized_mail=False,
                                      awareness_emailing=False,
                                      awareness_other='Other awareness',
                                      awareness_word_of_mouth=False,
                                      awareness_friends=False,
                                      awareness_former_students=False,
                                      awareness_moocs=False)
コード例 #2
0
    def setUpTestData(cls):
        group = EntityManagerGroupFactory()
        group.permissions.add(
            Permission.objects.get(codename='view_scoresresponsible'))
        group.permissions.add(
            Permission.objects.get(codename='change_scoresresponsible'))

        cls.tutor = TutorFactory()
        cls.user = cls.tutor.person.user
        cls.academic_year = AcademicYearFactory(current=True)

        # FIXME: Old structure model [To remove]
        cls.structure = structure.StructureFactory()
        cls.structure_children = structure.StructureFactory(
            part_of=cls.structure)

        # New structure model
        entities_hierarchy = create_entities_hierarchy()
        cls.root_entity = entities_hierarchy.get('root_entity')
        cls.child_one_entity = entities_hierarchy.get('child_one_entity')
        cls.child_two_entity = entities_hierarchy.get('child_two_entity')
        cls.learning_unit_yr_req_entity_acronym = entities_hierarchy.get(
            'child_one_entity_version').acronym
        cls.root_entity_acronym = entities_hierarchy.get(
            'root_entity_version').acronym

        cls.entity_manager = EntityManagerFactory(
            person=cls.tutor.person,
            structure=cls.structure,
            entity=cls.root_entity,
        )

        cls.learning_unit_year = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1210",
            structure=cls.structure,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1210",
            learning_container_year__requirement_entity=cls.child_one_entity,
        )

        cls.learning_unit_year_children = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1211",
            structure=cls.structure_children,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1211",
            learning_container_year__requirement_entity=cls.child_two_entity,
        )

        cls.attribution = AttributionFactory(
            tutor=cls.tutor,
            learning_unit_year=cls.learning_unit_year,
            score_responsible=True)
        cls.attribution_children = AttributionFactory(
            tutor=cls.tutor,
            learning_unit_year=cls.learning_unit_year_children,
            score_responsible=True)
        cls.url = reverse('scores_responsible_list')
        cls.user.groups.add(group)
コード例 #3
0
    def setUpTestData(cls):
        group = EntityManagerGroupFactory()
        group.permissions.add(
            Permission.objects.get(codename='view_scoresresponsible'))
        group.permissions.add(
            Permission.objects.get(codename='change_scoresresponsible'))

        cls.person = PersonFactory()
        cls.academic_year = AcademicYearFactory(
            year=datetime.date.today().year, start_date=datetime.date.today())

        # FIXME: Old structure model [To remove]
        cls.structure = structure.StructureFactory()

        entities_hierarchy = create_entities_hierarchy()
        cls.root_entity = entities_hierarchy.get('root_entity')

        cls.entity_manager = EntityManagerFactory(
            person=cls.person,
            structure=cls.structure,
            entity=cls.root_entity,
        )
        cls.entity_manager.person.user.groups.add(group)
        cls.learning_unit_year = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1210",
            structure=cls.structure,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1210",
            learning_container_year__requirement_entity=cls.root_entity,
        )
コード例 #4
0
    def setUpTestData(cls):
        group = ProgramManagerGroupFactory()
        group.permissions.add(
            Permission.objects.get(codename='view_scoresresponsible'))
        group.permissions.add(
            Permission.objects.get(codename='change_scoresresponsible'))

        cls.academic_year = create_current_academic_year()

        # FIXME: Old structure model [To remove]
        cls.structure = structure.StructureFactory()

        entities_hierarchy = create_entities_hierarchy()
        cls.root_entity = entities_hierarchy.get('root_entity')

        cls.learning_unit_year = LearningUnitYearFactory(
            academic_year=cls.academic_year,
            acronym="LBIR1210",
            structure=cls.structure,
            learning_container_year__academic_year=cls.academic_year,
            learning_container_year__acronym="LBIR1210",
            learning_container_year__requirement_entity=cls.root_entity,
        )
        cls.education_group_year = EducationGroupYearFactory(
            academic_year=cls.academic_year,
            administration_entity=cls.root_entity)
        cls.program_manager = ProgramManagerFactory(
            education_group=cls.education_group_year.education_group)
        cls.program_manager.person.user.groups.add(group)
        offer_enrollment = OfferEnrollmentFactory(
            education_group_year=cls.education_group_year)
        LearningUnitEnrollmentFactory(
            offer_enrollment=offer_enrollment,
            learning_unit_year=cls.learning_unit_year)
コード例 #5
0
def get_valid_external_learning_unit_form_data(academic_year, person, learning_unit_year=None):
    entities = create_entities_hierarchy()
    PersonEntityFactory(person=person, entity=entities['root_entity'], with_child=True)
    requesting_entity = entities['child_one_entity_version']
    organization = OrganizationFactory(type=organization_type.MAIN)
    campus = CampusFactory(organization=organization)
    language = LanguageFactory(code='FR')

    if not learning_unit_year:
        container_year = LearningContainerYearFactory(academic_year=academic_year)
        learning_unit_year = LearningUnitYearFactory.build(
            acronym='EOSIS1111',
            academic_year=academic_year,
            learning_container_year=container_year,
            subtype=learning_unit_year_subtypes.FULL,
            campus=campus,
            language=language
        )
    return {
        # Learning unit year data model form
        'acronym_0': learning_unit_year.acronym[0],
        'acronym_1': learning_unit_year.acronym[1:],
        'acronym_2': "A",
        'academic_year': learning_unit_year.academic_year.id,
        'specific_title': learning_unit_year.specific_title,
        'specific_title_english': learning_unit_year.specific_title_english,
        'credits': learning_unit_year.credits,
        'status': learning_unit_year.status,
        'campus': learning_unit_year.campus.id,
        'language': learning_unit_year.language.pk,
        'periodicity': learning_unit_year.periodicity,

        # Learning unit data model form
        'faculty_remark': learning_unit_year.learning_unit.faculty_remark,

        # Learning container year data model form
        'common_title': learning_unit_year.learning_container_year.common_title,
        'common_title_english': learning_unit_year.learning_container_year.common_title_english,
        'is_vacant': learning_unit_year.learning_container_year.is_vacant,

        # External learning unit model form
        'requirement_entity': requesting_entity.id,
        'allocation_entity': requesting_entity.id,
        'external_acronym': 'Gorzyne',
        'external_credits': '5',

        # Learning component year data model form
        'component-TOTAL_FORMS': '2',
        'component-INITIAL_FORMS': '0',
        'component-MAX_NUM_FORMS': '2',
        'component-0-hourly_volume_total_annual': 20,
        'component-0-hourly_volume_partial_q1': 10,
        'component-0-hourly_volume_partial_q2': 10,
        'component-0-planned_classes': 1,
        'component-1-hourly_volume_total_annual': 20,
        'component-1-hourly_volume_partial_q1': 10,
        'component-1-hourly_volume_partial_q2': 10,
        'component-1-planned_classes': 1,
    }
コード例 #6
0
    def setUp(self):
        group, created = Group.objects.get_or_create(name='entity_managers')
        content_type = ContentType.objects.get_for_model(EntityManager)
        perm, created = Permission.objects.get_or_create(codename='is_entity_manager', content_type=content_type)
        group.permissions.add(perm)
        self.person = PersonFactory()
        self.user = self.person.user
        self.tutor = TutorFactory(person=self.person)
        self.current_academic_year = create_current_academic_year()
        self.next_academic_year = AcademicYearFactory(
            year=self.current_academic_year.year + 1
        )

        # Old structure model [To remove]
        self.structure = structure.StructureFactory()
        self.structure_children = structure.StructureFactory(part_of=self.structure)

        # New structure model
        entities_hierarchy = create_entities_hierarchy()
        self.root_entity = entities_hierarchy.get('root_entity')
        self.child_one_entity = entities_hierarchy.get('child_one_entity')
        self.child_two_entity = entities_hierarchy.get('child_two_entity')

        self.entity_manager = EntityManagerFactory(
            person=self.person,
            structure=self.structure,
            entity=self.root_entity)

        # Create two learning_unit_year with context (Container + EntityContainerYear)
        self.learning_unit_year = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure,
            entity=self.child_one_entity,
            acronym="LBIR1210"
        )
        self.learning_unit_year_children = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure_children,
            entity=self.child_two_entity,
            acronym="LBIR1211"
        )

        self.attribution = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year,
            summary_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            summary_responsible=True)
コード例 #7
0
    def setUp(self):
        group, created = Group.objects.get_or_create(name='entity_managers')
        content_type = ContentType.objects.get_for_model(EntityManager)
        perm, created = Permission.objects.get_or_create(codename='is_entity_manager', content_type=content_type)
        group.permissions.add(perm)
        self.person = PersonFactory()
        self.user = self.person.user
        self.tutor = TutorFactory(person=self.person)
        self.current_academic_year = create_current_academic_year()
        self.next_academic_year = AcademicYearFactory(
            year=self.current_academic_year.year + 1
        )

        # Old structure model [To remove]
        self.structure = structure.StructureFactory()
        self.structure_children = structure.StructureFactory(part_of=self.structure)

        # New structure model
        entities_hierarchy = create_entities_hierarchy()
        self.root_entity = entities_hierarchy.get('root_entity')
        self.child_one_entity = entities_hierarchy.get('child_one_entity')
        self.child_two_entity = entities_hierarchy.get('child_two_entity')

        self.entity_manager = EntityManagerFactory(
            person=self.person,
            structure=self.structure,
            entity=self.root_entity)

        # Create two learning_unit_year with context (Container + EntityContainerYear)
        self.learning_unit_year = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure,
            entity=self.child_one_entity,
            acronym="LBIR1210"
        )
        self.learning_unit_year_children = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure_children,
            entity=self.child_two_entity,
            acronym="LBIR1211"
        )

        self.attribution = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year,
            summary_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            summary_responsible=True)
コード例 #8
0
    def setUp(self):
        self.person = PersonFactory()
        self.user = self.person.user
        self.tutor = TutorFactory(person=self.person)
        self.current_academic_year = create_current_academic_year()
        self.next_academic_year = AcademicYearFactory(
            year=self.current_academic_year.year + 1)

        # Old structure model [To remove]
        self.structure = structure.StructureFactory()
        self.structure_children = structure.StructureFactory(
            part_of=self.structure)

        # New structure model
        entities_hierarchy = create_entities_hierarchy()
        self.root_entity = entities_hierarchy.get('root_entity')
        self.child_one_entity = entities_hierarchy.get('child_one_entity')
        self.child_two_entity = entities_hierarchy.get('child_two_entity')

        self.entity_manager = EntityManagerFactory(person=self.person,
                                                   structure=self.structure,
                                                   entity=self.root_entity)

        # Create two learning_unit_year with context (Container + EntityContainerYear)
        self.learning_unit_year = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure,
            entity=self.child_one_entity,
            acronym="LBIR1210")
        self.learning_unit_year_children = create_learning_unit_with_context(
            academic_year=self.next_academic_year,
            structure=self.structure_children,
            entity=self.child_two_entity,
            acronym="LBIR1211")

        self.attribution = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year,
            summary_responsible=True)
        self.attribution_children = test_attribution.create_attribution(
            tutor=self.tutor,
            learning_unit_year=self.learning_unit_year_children,
            summary_responsible=True)
コード例 #9
0
def get_valid_form_data(academic_year, person, learning_unit_year=None):
    entities = create_entities_hierarchy()
    PersonEntityFactory(person=person,
                        entity=entities['root_entity'],
                        with_child=True)
    requirement_entity_version = entities['child_one_entity_version']
    organization = OrganizationFactory(type=organization_type.MAIN)
    campus = CampusFactory(organization=organization)
    language = LanguageFactory(code='FR')

    if not learning_unit_year:
        learning_container = LearningContainerFactory()
        container_year = LearningContainerYearFactory(
            academic_year=academic_year, learning_container=learning_container)

        learning_unit_full = LearningUnitFactory(
            learning_container=learning_container,
            start_year=academic_year.year,
            end_year=academic_year.year,
        )

        learning_unit_year = LearningUnitYearFactory.build(
            academic_year=academic_year,
            learning_unit=learning_unit_full,
            learning_container_year=container_year,
            subtype=learning_unit_year_subtypes.FULL,
            campus=campus,
            language=language,
            periodicity=learning_unit_year_periodicity.ANNUAL)

    cm_lcy = LearningComponentYear.objects.filter(
        learning_unit_year=learning_unit_year).first()
    pp_lcy = LearningComponentYear.objects.filter(
        learning_unit_year=learning_unit_year).last()

    return {
        # Learning unit year data model form
        'acronym': learning_unit_year.acronym,
        'acronym_0': learning_unit_year.acronym[0],
        'acronym_1': learning_unit_year.acronym[1:],
        'subtype': learning_unit_year.subtype,
        'academic_year': learning_unit_year.academic_year.id,
        'specific_title': learning_unit_year.specific_title,
        'specific_title_english': learning_unit_year.specific_title_english,
        'credits': learning_unit_year.credits,
        'session': learning_unit_year.session,
        'quadrimester': learning_unit_year.quadrimester,
        'status': learning_unit_year.status,
        'internship_subtype': None,
        'attribution_procedure': learning_unit_year.attribution_procedure,
        'campus': learning_unit_year.campus.id,
        'language': learning_unit_year.language.pk,
        'periodicity': learning_unit_year.periodicity,

        # Learning unit data model form
        'faculty_remark': learning_unit_year.learning_unit.faculty_remark,
        'other_remark': learning_unit_year.learning_unit.other_remark,

        # Learning container year data model form
        'common_title':
        learning_unit_year.learning_container_year.common_title,
        'common_title_english':
        learning_unit_year.learning_container_year.common_title_english,
        'container_type':
        learning_unit_year.learning_container_year.container_type,
        'type_declaration_vacant':
        learning_unit_year.learning_container_year.type_declaration_vacant,
        'team': learning_unit_year.learning_container_year.team,
        'is_vacant': learning_unit_year.learning_container_year.is_vacant,
        'requirement_entity-entity': requirement_entity_version.id,
        'allocation_entity-entity': requirement_entity_version.id,
        'additional_requirement_entity_1-entity': '',

        # Learning component year data model form
        'component-0-id': cm_lcy and cm_lcy.pk,
        'component-1-id': pp_lcy and pp_lcy.pk,
        'component-TOTAL_FORMS': '2',
        'component-INITIAL_FORMS': '0' if not cm_lcy else '2',
        'component-MAX_NUM_FORMS': '2',
        'component-0-hourly_volume_total_annual': 20,
        'component-0-hourly_volume_partial_q1': 10,
        'component-0-hourly_volume_partial_q2': 10,
        'component-1-hourly_volume_total_annual': 20,
        'component-1-hourly_volume_partial_q1': 10,
        'component-1-hourly_volume_partial_q2': 10,
    }