コード例 #1
0
ファイル: common.py プロジェクト: kelvinninja1/osis
def get_learning_unit_identification_context(learning_unit_year_id, person):
    context = get_common_context_learning_unit_year(learning_unit_year_id,
                                                    person)

    learning_unit_year = context['learning_unit_year']
    context['warnings'] = learning_unit_year.warnings
    proposal = proposal_learning_unit.find_by_learning_unit(
        learning_unit_year.learning_unit)

    context["can_create_partim"] = is_eligible_to_create_partim(
        learning_unit_year, person)
    context[
        'learning_container_year_partims'] = learning_unit_year.get_partims_related(
        )
    context['organization'] = get_organization_from_learning_unit_year(
        learning_unit_year)
    context['campus'] = learning_unit_year.campus
    context['experimental_phase'] = True
    context.update(get_all_attributions(learning_unit_year))
    components = get_components_identification(learning_unit_year)
    context['components'] = components.get('components')
    context['REQUIREMENT_ENTITY'] = components.get('REQUIREMENT_ENTITY')
    context['ADDITIONAL_REQUIREMENT_ENTITY_1'] = components.get(
        'ADDITIONAL_REQUIREMENT_ENTITY_1')
    context['ADDITIONAL_REQUIREMENT_ENTITY_2'] = components.get(
        'ADDITIONAL_REQUIREMENT_ENTITY_2')
    context['proposal'] = proposal
    context[
        'proposal_folder_entity_version'] = mdl.entity_version.get_by_entity_and_date(
            proposal.entity, None) if proposal else None
    context['differences'] = get_difference_of_proposal(proposal, learning_unit_year) \
        if proposal and proposal.learning_unit_year == learning_unit_year \
        else {}

    # append permissions
    context.update(learning_unit_year_permissions(learning_unit_year, person))
    context.update(
        learning_unit_proposal_permissions(proposal, person,
                                           learning_unit_year))
    context['can_manage_volume'] = is_eligible_for_modification(
        context["learning_unit_year"], person)

    return context
コード例 #2
0
 def test_find_by_learning_unit(self):
     a_proposal_learning_unit = proposal_learning_unit.find_by_learning_unit(
         self.proposal_learning_unit.learning_unit_year.learning_unit)
     self.assertEqual(a_proposal_learning_unit, self.proposal_learning_unit)