From d05aa01e862f8c6a02de5efc818f919dcc2a3e42 Mon Sep 17 00:00:00 2001 From: Gagaro Date: Mon, 13 Jan 2025 17:05:02 +0100 Subject: [PATCH] =?UTF-8?q?Fix=20OS-1307:=20D=C3=A9placer=20le=20mod=C3=A8?= =?UTF-8?q?le=20Scholarship=20dans=20OSIS=20R=C3=A9f=C3=A9rence?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .isort.cfg | 1 + .pre-commit-config.yaml | 2 +- admin.py | 109 ++-- api/schema.py | 4 +- api/serializers/__init__.py | 69 ++- api/serializers/scholarship.py | 39 -- api/url_v1.py | 7 +- api/views/__init__.py | 50 +- api/views/autocomplete.py | 68 +-- api/views/references.py | 22 +- .../preparation/domain/model/_financement.py | 8 +- .../preparation/domain/model/proposition.py | 130 +++-- .../doctorat/preparation/dtos/doctorat.py | 4 +- .../doctorat/preparation/dtos/proposition.py | 12 +- .../write/test_initier_proposition_service.py | 35 +- ...hoix_formation_par_gestionnaire_service.py | 15 +- .../write/completer_proposition_service.py | 28 +- .../domain/builder/bourse_identity.py | 41 -- ddd/admission/domain/model/bourse.py | 33 -- ddd/admission/domain/service/i_bourse.py | 58 -- ddd/admission/domain/validator/exceptions.py | 10 +- ddd/admission/dtos/bourse.py | 39 -- ddd/admission/enums/__init__.py | 1 - ddd/admission/enums/type_bourse.py | 35 -- .../domain/builder/proposition_builder.py | 16 +- .../domain/model/proposition.py | 129 +++-- .../formation_generale/dtos/proposition.py | 11 +- ...st_lister_propositions_candidat_service.py | 22 +- ...uperer_proposition_gestionnaire_service.py | 26 +- .../test_recuperer_proposition_service.py | 26 +- .../write/test_initier_proposition_service.py | 40 +- ...hoix_formation_par_gestionnaire_service.py | 20 +- .../test_modifier_choix_formation_service.py | 22 +- .../write/initier_proposition_service.py | 32 +- ...hoix_formation_par_gestionnaire_service.py | 20 +- .../write/modifier_choix_formation_service.py | 24 +- ddd/admission/test/factory/bourse.py | 7 +- forms/__init__.py | 12 +- forms/admission/doctorate/project.py | 16 +- forms/admission/filter.py | 33 +- forms/admission/training_choice.py | 45 +- forms/doctorate/cdd/filter.py | 23 +- .../preparation/handlers_in_memory.py | 95 +++- .../preparation/repository/doctorat.py | 40 +- .../repository/in_memory/doctorat.py | 23 +- .../repository/in_memory/proposition.py | 67 ++- .../preparation/repository/proposition.py | 330 ++++++----- .../admission/domain/service/bourse.py | 86 --- .../domain/service/in_memory/bourse.py | 137 ----- .../admission/formation_generale/handlers.py | 141 +++-- .../formation_generale/handlers_in_memory.py | 54 +- .../repository/in_memory/proposition.py | 145 +++-- .../repository/proposition.py | 535 ++++++++++-------- locale/en/LC_MESSAGES/django.po | 34 -- locale/fr_BE/LC_MESSAGES/django.po | 54 -- ...sion_international_scholarship_and_more.py | 63 +++ migrations/0238_delete_scholarship.py | 20 + models/__init__.py | 25 +- models/actor.py | 8 +- models/doctorate.py | 26 +- models/general_education.py | 32 +- models/scholarship.py | 67 --- schema.yml | 125 +--- .../views/autocomplete/test_scholarship.py | 115 ---- .../api/views/references/test_scholarship.py | 69 --- tests/api/views/test_specific_questions.py | 19 +- tests/api/views/test_training_choice.py | 36 +- ...st_get_proposition_dto_for_gestionnaire.py | 42 +- ...st_get_proposition_dto_for_gestionnaire.py | 36 +- tests/factories/general_education.py | 22 +- tests/factories/scholarship.py | 72 --- tests/views/cdd/test_list.py | 36 +- .../form_tabs/training_choice/test_general.py | 34 +- tests/views/doctorate/cdd/test_list.py | 29 +- .../checklist/sic_decision/test_approval.py | 23 +- .../checklist/sic_decision/test_approval.py | 28 +- tests/views/test_excel_exports.py | 72 ++- utils.py | 74 ++- views/autocomplete/scholarship.py | 6 +- views/excel_exports.py | 70 ++- 80 files changed, 1965 insertions(+), 2269 deletions(-) create mode 120000 .isort.cfg delete mode 100644 api/serializers/scholarship.py delete mode 100644 ddd/admission/domain/builder/bourse_identity.py delete mode 100644 ddd/admission/domain/model/bourse.py delete mode 100644 ddd/admission/domain/service/i_bourse.py delete mode 100644 ddd/admission/dtos/bourse.py delete mode 100644 ddd/admission/enums/type_bourse.py delete mode 100644 infrastructure/admission/domain/service/bourse.py delete mode 100644 infrastructure/admission/domain/service/in_memory/bourse.py create mode 100644 migrations/0237_alter_doctorateadmission_international_scholarship_and_more.py create mode 100644 migrations/0238_delete_scholarship.py delete mode 100644 models/scholarship.py delete mode 100644 tests/api/views/autocomplete/test_scholarship.py delete mode 100644 tests/api/views/references/test_scholarship.py delete mode 100644 tests/factories/scholarship.py diff --git a/.isort.cfg b/.isort.cfg new file mode 120000 index 000000000..62a72913b --- /dev/null +++ b/.isort.cfg @@ -0,0 +1 @@ +../.isort.cfg \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c314beef6..974798386 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,7 +26,7 @@ repos: files: \.(py|html)$ args: [ --multiline, --negate ] exclude: '^(migrations/\w+|.*__init__).py' - entry: '2015\-2024' + entry: '2015\-2025' language: pygrep - id: diff-quality diff --git a/admin.py b/admin.py index d70239baf..8b3837176 100644 --- a/admin.py +++ b/admin.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,10 +33,12 @@ from django.contrib.messages import info, warning from django.contrib.postgres.fields import ArrayField from django.db import models -from django.db.models import Q, Exists, OuterRef, F, Value, When, Case +from django.db.models import Case, Exists, F, OuterRef, Q, Value, When from django.shortcuts import resolve_url from django.utils.safestring import mark_safe -from django.utils.translation import gettext_lazy as _, pgettext, pgettext_lazy, ngettext, get_language +from django.utils.translation import get_language +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import ngettext, pgettext, pgettext_lazy from django_admin_listfilter_dropdown.filters import RelatedDropdownFilter from django_json_widget.widgets import JSONEditorWidget from hijack.contrib.admin import HijackUserAdminMixin @@ -51,45 +53,61 @@ from admission.auth.roles.promoter import Promoter from admission.auth.roles.sceb import Sceb from admission.auth.roles.sic_management import SicManagement +from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( + ChoixStatutPropositionDoctorale, +) +from admission.ddd.admission.doctorat.preparation.domain.model.statut_checklist import ( + ORGANISATION_ONGLETS_CHECKLIST_POUR_LISTING, +) +from admission.ddd.admission.enums import CritereItemFormulaireFormation +from admission.ddd.admission.enums.statut import CHOIX_STATUT_TOUTE_PROPOSITION +from admission.ddd.admission.formation_continue.domain.model.enums import ( + ChoixStatutPropositionContinue, +) +from admission.ddd.admission.formation_continue.domain.model.statut_checklist import ( + ORGANISATION_ONGLETS_CHECKLIST as ORGANISATION_ONGLETS_CHECKLIST_CONTINUE, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) +from admission.ddd.admission.formation_generale.domain.model.statut_checklist import ( + ORGANISATION_ONGLETS_CHECKLIST as ORGANISATION_ONGLETS_CHECKLIST_GENERALE, +) +from admission.forms.checklist_state_filter import ChecklistStateFilterField from admission.models import ( + Accounting, AdmissionTask, AdmissionViewer, ContinuingEducationAdmission, + DiplomaticPost, DoctorateAdmission, GeneralEducationAdmission, - Scholarship, - Accounting, - DiplomaticPost, ) from admission.models.base import BaseAdmission from admission.models.categorized_free_document import CategorizedFreeDocument from admission.models.checklist import ( - RefusalReasonCategory, - RefusalReason, AdditionalApprovalCondition, FreeAdditionalApprovalCondition, + RefusalReason, + RefusalReasonCategory, +) +from admission.models.epc_injection import ( + EPCInjection, + EPCInjectionStatus, + EPCInjectionType, ) -from admission.models.epc_injection import EPCInjection, EPCInjectionStatus, EPCInjectionType from admission.models.form_item import AdmissionFormItem, AdmissionFormItemInstantiation from admission.models.online_payment import OnlinePayment -from admission.models.working_list import WorkingList, ContinuingWorkingList, DoctorateWorkingList -from admission.ddd.admission.doctorat.preparation.domain.model.enums import ChoixStatutPropositionDoctorale -from admission.ddd.admission.enums import CritereItemFormulaireFormation -from admission.ddd.admission.enums.statut import CHOIX_STATUT_TOUTE_PROPOSITION -from admission.ddd.admission.formation_continue.domain.model.enums import ChoixStatutPropositionContinue -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale -from admission.ddd.admission.formation_generale.domain.model.statut_checklist import ( - ORGANISATION_ONGLETS_CHECKLIST as ORGANISATION_ONGLETS_CHECKLIST_GENERALE, -) -from admission.ddd.admission.formation_continue.domain.model.statut_checklist import ( - ORGANISATION_ONGLETS_CHECKLIST as ORGANISATION_ONGLETS_CHECKLIST_CONTINUE, -) -from admission.ddd.admission.doctorat.preparation.domain.model.statut_checklist import ( - ORGANISATION_ONGLETS_CHECKLIST_POUR_LISTING, +from admission.models.working_list import ( + ContinuingWorkingList, + DoctorateWorkingList, + WorkingList, ) -from admission.forms.checklist_state_filter import ChecklistStateFilterField from admission.services.injection_epc.injection_dossier import InjectionEPCAdmission -from admission.tasks import bulk_create_digit_persons_tickets, injecter_signaletique_a_epc_task +from admission.tasks import ( + bulk_create_digit_persons_tickets, + injecter_signaletique_a_epc_task, +) from admission.views.mollie_webhook import MollieWebHook from base.models.academic_year import AcademicYear from base.models.education_group_type import EducationGroupType @@ -103,7 +121,6 @@ from osis_profile.models import EducationalExperience, ProfessionalExperience from osis_role.contrib.admin import EntityRoleModelAdmin, RoleModelAdmin - # ############################################################################## # Models @@ -303,34 +320,6 @@ def trigger_payment_hook(self, request, queryset): ) -@admin.register(Scholarship) -class ScholarshipAdmin(admin.ModelAdmin): - list_display = [ - 'short_name', - 'long_name', - 'type', - 'enabled', - ] - search_fields = [ - 'short_name', - 'long_name', - ] - list_filter = [ - 'type', - 'disabled', - ] - fields = [ - 'type', - 'short_name', - 'long_name', - 'disabled', - ] - - @admin.display(description=_('Enabled'), boolean=True) - def enabled(self, obj): - return not obj.disabled - - FORM_ITEM_MIN_YEAR = 2022 @@ -667,15 +656,15 @@ def queryset(self, request, queryset): | Q( checklist__current__financabilite__status='GEST_REUSSITE', checklist__current__financanbilite__extra__reussite='financable', - generaleducationadmission__financability_rule='' + generaleducationadmission__financability_rule='', ) | Q( checklist__current__financabilite__status='GEST_REUSSITE', - generaleducationadmission__financability_established_on__isnull=True + generaleducationadmission__financability_established_on__isnull=True, ) | Q( checklist__current__financabilite__status='GEST_REUSSITE', - generaleducationadmission__financability_established_by_id__isnull=True + generaleducationadmission__financability_established_by_id__isnull=True, ), generaleducationadmission__isnull=False, then=Value(False), @@ -758,13 +747,10 @@ def get_queryset(self, request): ) ) - @admin.display( - ordering='_noma_sent_to_digit' - ) + @admin.display(ordering='_noma_sent_to_digit') def noma_sent_to_digit(self, obj): return obj._noma_sent_to_digit - @admin.action(description='Injecter la demande dans EPC') def injecter_dans_epc(self, request, queryset): for demande in queryset.exclude( @@ -922,6 +908,7 @@ def has_add_permission(self, request) -> bool: def has_change_permission(self, request, obj=None) -> bool: return False + # ############################################################################## # Roles diff --git a/api/schema.py b/api/schema.py index 63693a17b..955c02fc3 100644 --- a/api/schema.py +++ b/api/schema.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ from backoffice.settings.rest_framework.fields import ActionLinksField from base.models.utils.utils import ChoiceEnum -ADMISSION_SDK_VERSION = "1.0.110" +ADMISSION_SDK_VERSION = "1.0.113" class AdmissionSchemaGenerator(SchemaGenerator): diff --git a/api/serializers/__init__.py b/api/serializers/__init__.py index d99dc6aad..a7d5a46fc 100644 --- a/api/serializers/__init__.py +++ b/api/serializers/__init__.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,51 +24,50 @@ # # ############################################################################## -from .dashboard import DashboardSerializer -from .project import * -from .cotutelle import * -from .person import * +from .accounting import ( + CompleterComptabilitePropositionDoctoraleCommandSerializer, + CompleterComptabilitePropositionGeneraleCommandSerializer, + DoctorateEducationAccountingDTOSerializer, + GeneralEducationAccountingDTOSerializer, +) +from .approvals import ( + ApprouverPropositionCommandSerializer, + ApprouverPropositionParPdfCommandSerializer, + RefuserPropositionCommandSerializer, +) +from .campus import CampusSerializer +from .continuing_education import InformationsSpecifiquesFormationContinueDTOSerializer from .coordonnees import CoordonneesSerializer -from .secondary_studies import HighSchoolDiplomaSerializer -from .languages_knowledge import * -from .supervision import * +from .cotutelle import * from .curriculum import ( - EducationalExperienceYearSerializer, + ContinuingEducationCompleterCurriculumCommandSerializer, CurriculumDetailsSerializer, - ProfessionalExperienceSerializer, DoctoratCompleterCurriculumCommandSerializer, - ContinuingEducationCompleterCurriculumCommandSerializer, + EducationalExperienceYearSerializer, GeneralEducationCompleterCurriculumCommandSerializer, + ProfessionalExperienceSerializer, ) -from .approvals import ( - ApprouverPropositionCommandSerializer, - RefuserPropositionCommandSerializer, - ApprouverPropositionParPdfCommandSerializer, -) +from .dashboard import DashboardSerializer +from .diplomatic_post import DiplomaticPostSerializer from .doctorate import * -from .accounting import ( - DoctorateEducationAccountingDTOSerializer, - GeneralEducationAccountingDTOSerializer, - CompleterComptabilitePropositionDoctoraleCommandSerializer, - CompleterComptabilitePropositionGeneraleCommandSerializer, +from .documents import * +from .languages_knowledge import * +from .payment import * +from .pdf_recap import PDFRecapSerializer +from .person import * +from .project import * +from .secondary_studies import HighSchoolDiplomaSerializer +from .specific_question import ( + ModifierQuestionsSpecifiquesFormationContinueCommandSerializer, + ModifierQuestionsSpecifiquesFormationGeneraleCommandSerializer, + SpecificQuestionSerializer, ) -from .scholarship import ScholarshipSerializer -from .campus import CampusSerializer +from .submission import PropositionErrorsSerializer, SubmitPropositionSerializer +from .supervision import * from .training_choice import ( InitierPropositionContinueCommandSerializer, InitierPropositionGeneraleCommandSerializer, ModifierChoixFormationContinueCommandSerializer, - ModifierTypeAdmissionDoctoraleCommandSerializer, ModifierChoixFormationGeneraleCommandSerializer, + ModifierTypeAdmissionDoctoraleCommandSerializer, ) -from .specific_question import ( - SpecificQuestionSerializer, - ModifierQuestionsSpecifiquesFormationGeneraleCommandSerializer, - ModifierQuestionsSpecifiquesFormationContinueCommandSerializer, -) -from .submission import PropositionErrorsSerializer, SubmitPropositionSerializer -from .pdf_recap import PDFRecapSerializer -from .documents import * -from .payment import * -from .diplomatic_post import DiplomaticPostSerializer -from .continuing_education import InformationsSpecifiquesFormationContinueDTOSerializer diff --git a/api/serializers/scholarship.py b/api/serializers/scholarship.py deleted file mode 100644 index 0ceb2e7e7..000000000 --- a/api/serializers/scholarship.py +++ /dev/null @@ -1,39 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -from rest_framework.serializers import ModelSerializer - -from admission.models import Scholarship - - -class ScholarshipSerializer(ModelSerializer): - class Meta: - model = Scholarship - fields = [ - 'uuid', - 'short_name', - 'long_name', - 'type', - ] diff --git a/api/url_v1.py b/api/url_v1.py index 5793c0891..1ee5be1e0 100644 --- a/api/url_v1.py +++ b/api/url_v1.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,7 +23,8 @@ # see http://www.gnu.org/licenses/. # # ############################################################################## -from django.urls import include, path as _path +from django.urls import include +from django.urls import path as _path from rest_framework.routers import SimpleRouter import admission.api.views.submission @@ -170,9 +171,7 @@ def path(pattern, view, name=None): path('autocomplete/tutor', views.AutocompleteTutorView), path('autocomplete/person', views.AutocompletePersonView), path('autocomplete/diplomatic-post', views.AutocompleteDiplomaticPostView), - path('autocomplete//scholarship', views.AutocompleteScholarshipView), # Others - path('scholarship/', views.RetrieveScholarshipView), path('campus', views.ListCampusView), path('campus/', views.RetrieveCampusView), path('diplomatic-post/', views.RetrieveDiplomaticPostView), diff --git a/api/views/__init__.py b/api/views/__init__.py index bd3487ebd..c9eb2254b 100644 --- a/api/views/__init__.py +++ b/api/views/__init__.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,55 +23,71 @@ # see http://www.gnu.org/licenses/. # # ############################################################################## -from admission.api.views.accounting import DoctorateAccountingView, GeneralAccountingView +from admission.api.views.accounting import ( + DoctorateAccountingView, + GeneralAccountingView, +) from admission.api.views.approvals import * from admission.api.views.autocomplete import * -from admission.api.views.continuing_education import RetrieveContinuingEducationSpecificInformationView -from admission.api.views.coordonnees import CoordonneesViewSet, GeneralCoordonneesView, ContinuingCoordonneesView +from admission.api.views.continuing_education import ( + RetrieveContinuingEducationSpecificInformationView, +) +from admission.api.views.coordonnees import ( + ContinuingCoordonneesView, + CoordonneesViewSet, + GeneralCoordonneesView, +) from admission.api.views.cotutelle import CotutelleAPIView from admission.api.views.curriculum import * from admission.api.views.dashboard import DashboardViewSet from admission.api.views.doctorate import DoctorateAPIView from admission.api.views.documents import ( - GeneralRequestedDocumentListView, ContinuingRequestedDocumentListView, DoctorateRequestedDocumentListView, + GeneralRequestedDocumentListView, ) from admission.api.views.languages_knowledge import LanguagesKnowledgeViewSet from admission.api.views.payment import ( - OpenApplicationFeesPaymentView, ApplicationFeesListView, + OpenApplicationFeesPaymentView, ) from admission.api.views.payment_method import PaymentMethodAPIView -from admission.api.views.pdf_recap import ContinuingPDFRecapView, GeneralPDFRecapView, DoctoratePDFRecapView +from admission.api.views.pdf_recap import ( + ContinuingPDFRecapView, + DoctoratePDFRecapView, + GeneralPDFRecapView, +) from admission.api.views.person import ( - PersonViewSet, - GeneralPersonView, ContinuingPersonView, + GeneralPersonView, IdentificationDTOView, + PersonViewSet, ) from admission.api.views.pool_questions import PoolQuestionsView from admission.api.views.project import * -from admission.api.views.proposition import GeneralPropositionView, ContinuingPropositionView, DoctoratePropositionView +from admission.api.views.proposition import ( + ContinuingPropositionView, + DoctoratePropositionView, + GeneralPropositionView, +) from admission.api.views.references import ( ListCampusView, RetrieveCampusView, RetrieveDiplomaticPostView, - RetrieveScholarshipView, ) from admission.api.views.secondary_studies import ( - SecondaryStudiesViewSet, - GeneralSecondaryStudiesView, ContinuingSecondaryStudiesView, + GeneralSecondaryStudiesView, + SecondaryStudiesViewSet, ) from admission.api.views.signatures import RequestSignaturesAPIView from admission.api.views.specific_questions import ( - GeneralSpecificQuestionListView, - DoctorateSpecificQuestionListView, - ContinuingSpecificQuestionListView, - GeneralSpecificQuestionAPIView, ContinuingSpecificQuestionAPIView, + ContinuingSpecificQuestionListView, + DoctorateSpecificQuestionListView, GeneralIdentificationView, + GeneralSpecificQuestionAPIView, + GeneralSpecificQuestionListView, ) from admission.api.views.submission import * from admission.api.views.supervision import * diff --git a/api/views/autocomplete.py b/api/views/autocomplete.py index 78232f835..98d6938e6 100644 --- a/api/views/autocomplete.py +++ b/api/views/autocomplete.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,7 +25,15 @@ # ############################################################################## from django.conf import settings from django.contrib.postgres.aggregates import ArrayAgg -from django.db.models import Exists, F, OuterRef, Q, TextField, ExpressionWrapper, BooleanField +from django.db.models import ( + BooleanField, + Exists, + ExpressionWrapper, + F, + OuterRef, + Q, + TextField, +) from django.utils.decorators import method_decorator from django.utils.translation import get_language, get_language_from_request from django.views.decorators.cache import cache_page @@ -35,16 +43,26 @@ from rules.contrib.views import LoginRequiredMixin from admission.api import serializers -from admission.api.schema import AuthorizationAwareSchema, ResponseSpecificSchema, BetterChoicesSchema +from admission.api.schema import ( + AuthorizationAwareSchema, + BetterChoicesSchema, + ResponseSpecificSchema, +) from admission.api.serializers import PersonSerializer -from admission.models import EntityProxy, Scholarship, DiplomaticPost -from admission.ddd.admission.doctorat.preparation.commands import RechercherDoctoratQuery +from admission.ddd.admission.doctorat.preparation.commands import ( + RechercherDoctoratQuery, +) from admission.ddd.admission.domain.enums import LISTE_TYPES_FORMATION_GENERALE -from admission.ddd.admission.formation_continue.commands import RechercherFormationContinueQuery -from admission.ddd.admission.formation_generale.commands import RechercherFormationGeneraleQuery +from admission.ddd.admission.formation_continue.commands import ( + RechercherFormationContinueQuery, +) +from admission.ddd.admission.formation_generale.commands import ( + RechercherFormationGeneraleQuery, +) from admission.infrastructure.admission.domain.service.annee_inscription_formation import ( AnneeInscriptionFormationTranslator, ) +from admission.models import DiplomaticPost, EntityProxy from base.auth.roles.tutor import Tutor from base.models.education_group_year import EducationGroupYear from base.models.entity_version import EntityVersion @@ -64,7 +82,6 @@ "AutocompletePersonView", "AutocompleteGeneralEducationView", "AutocompleteContinuingEducationView", - "AutocompleteScholarshipView", "AutocompleteDiplomaticPostView", ] @@ -259,41 +276,6 @@ def get_schema_operation_parameters(self, view): # pragma: no cover ] -class ScholarshipSearchBackend(BaseFilterBackend): - searching_param = 'search' - - def filter_queryset(self, request, queryset, view): - search_term = request.GET.get(self.searching_param, '') - scholarship_type = view.kwargs.get('scholarship_type', '') - - return queryset.filter(type=scholarship_type).filter( - Q(short_name__icontains=search_term) | Q(long_name__icontains=search_term) - ) - - def get_schema_operation_parameters(self, view): # pragma: no cover - return [ - { - 'name': self.searching_param, - 'required': False, - 'in': 'query', - 'description': 'The term to search the scholarship on (short or long name)', - 'schema': { - 'type': 'string', - }, - }, - ] - - -class AutocompleteScholarshipView(ListAPIView): - """Autocomplete scholarships""" - - name = 'autocomplete-scholarships' - schema = AuthorizationAwareSchema() - filter_backends = [ScholarshipSearchBackend] - serializer_class = serializers.ScholarshipSerializer - queryset = Scholarship.objects.exclude(disabled=True).order_by('long_name', 'short_name') - - class CampusSearchBackend(BaseFilterBackend): searching_param = 'search' diff --git a/api/views/references.py b/api/views/references.py index d5c793eed..4b639af45 100644 --- a/api/views/references.py +++ b/api/views/references.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,29 +24,21 @@ # # ############################################################################## from django.http import Http404 -from rest_framework.generics import RetrieveAPIView, ListAPIView +from rest_framework.generics import ListAPIView, RetrieveAPIView from rest_framework.response import Response from admission.api import serializers from admission.api.schema import AuthorizationAwareSchema from admission.constants import ORDERED_CAMPUSES_UUIDS -from admission.models import Scholarship, DiplomaticPost +from admission.models import DiplomaticPost from base.models.campus import Campus -from ddd.logic.shared_kernel.campus.commands import SearchUclouvainCampusesQuery, GetCampusQuery +from ddd.logic.shared_kernel.campus.commands import ( + GetCampusQuery, + SearchUclouvainCampusesQuery, +) from infrastructure.messages_bus import message_bus_instance -class RetrieveScholarshipView(RetrieveAPIView): - """Retrieves a scholarship""" - - name = 'retrieve-scholarship' - schema = AuthorizationAwareSchema() - filter_backends = [] - serializer_class = serializers.ScholarshipSerializer - queryset = Scholarship.objects.all() - lookup_field = 'uuid' - - class RetrieveCampusView(RetrieveAPIView): """Retrieves a campus""" diff --git a/ddd/admission/doctorat/preparation/domain/model/_financement.py b/ddd/admission/doctorat/preparation/domain/model/_financement.py index 5e0ed4eb5..96f05e0b6 100644 --- a/ddd/admission/doctorat/preparation/domain/model/_financement.py +++ b/ddd/admission/doctorat/preparation/domain/model/_financement.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,8 +28,10 @@ import attr -from admission.ddd.admission.doctorat.preparation.domain.model.enums import ChoixTypeFinancement -from admission.ddd.admission.domain.model.bourse import BourseIdentity +from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( + ChoixTypeFinancement, +) +from ddd.logic.reference.domain.model.bourse import BourseIdentity from osis_common.ddd import interface diff --git a/ddd/admission/doctorat/preparation/domain/model/proposition.py b/ddd/admission/doctorat/preparation/domain/model/proposition.py index bc483a98c..0ba3d87ea 100644 --- a/ddd/admission/doctorat/preparation/domain/model/proposition.py +++ b/ddd/admission/doctorat/preparation/domain/model/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -46,8 +46,12 @@ Financement, financement_non_rempli, ) -from admission.ddd.admission.doctorat.preparation.domain.model._institut import InstitutIdentity -from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import DoctoratFormation +from admission.ddd.admission.doctorat.preparation.domain.model._institut import ( + InstitutIdentity, +) +from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( + DoctoratFormation, +) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( ChoixCommissionProximiteCDEouCLSM, ChoixCommissionProximiteCDSS, @@ -59,59 +63,74 @@ ) from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( BesoinDeDerogation, - OngletsChecklist, - DecisionCDDEnum, -) -from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( ChoixStatutChecklist, + DecisionCDDEnum, DerogationFinancement, + DispenseOuDroitsMajores, + DroitsInscriptionMontant, + MobiliteNombreDeMois, + OngletsChecklist, ) -from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import DispenseOuDroitsMajores -from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import DroitsInscriptionMontant -from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import MobiliteNombreDeMois from admission.ddd.admission.doctorat.preparation.domain.model.statut_checklist import ( - StatutsChecklistDoctorale, StatutChecklist, + StatutsChecklistDoctorale, ) from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( CurriculumNonCompletePourAcceptationException, ) from admission.ddd.admission.doctorat.preparation.domain.validator.validator_by_business_action import ( + ApprouverAdmissionParSicValidatorList, + ApprouverInscriptionParSicValidatorList, + ApprouverParCDDValidatorList, + ApprouverParSicAValiderValidatorList, CompletionPropositionValidatorList, + GestionnairePeutSoumettreAuSicLorsDeLaDecisionCDDValidatorList, + ModifierStatutChecklistParcoursAnterieurValidatorList, ModifierTypeAdmissionValidatorList, PropositionProjetDoctoralValidatorList, - ModifierStatutChecklistParcoursAnterieurValidatorList, + RedonnerLaMainAuCandidatValidatorList, + RefuserParCDDValidatorList, + SICPeutSoumettreAuCDDLorsDeLaDecisionCDDValidatorList, SpecifierConditionAccesParcoursAnterieurValidatorList, - ApprouverParSicAValiderValidatorList, SpecifierInformationsApprobationInscriptionValidatorList, - ApprouverInscriptionParSicValidatorList, - ApprouverAdmissionParSicValidatorList, - SICPeutSoumettreAuCDDLorsDeLaDecisionCDDValidatorList, - ApprouverParCDDValidatorList, - RefuserParCDDValidatorList, - GestionnairePeutSoumettreAuSicLorsDeLaDecisionCDDValidatorList, SpecifierNouvellesInformationsDecisionCDDValidatorList, - RedonnerLaMainAuCandidatValidatorList, ) -from admission.ddd.admission.doctorat.preparation.dtos.curriculum import CurriculumAdmissionDTO +from admission.ddd.admission.doctorat.preparation.dtos.curriculum import ( + CurriculumAdmissionDTO, +) from admission.ddd.admission.domain.model._profil_candidat import ProfilCandidat -from admission.ddd.admission.domain.model.bourse import BourseIdentity -from admission.ddd.admission.domain.model.complement_formation import ComplementFormationIdentity +from admission.ddd.admission.domain.model.complement_formation import ( + ComplementFormationIdentity, +) from admission.ddd.admission.domain.model.enums.equivalence import ( - TypeEquivalenceTitreAcces, - StatutEquivalenceTitreAcces, EtatEquivalenceTitreAcces, + StatutEquivalenceTitreAcces, + TypeEquivalenceTitreAcces, +) +from admission.ddd.admission.domain.model.enums.type_gestionnaire import ( + TypeGestionnaire, ) -from admission.ddd.admission.domain.model.enums.type_gestionnaire import TypeGestionnaire from admission.ddd.admission.domain.model.formation import FormationIdentity from admission.ddd.admission.domain.model.motif_refus import MotifRefusIdentity from admission.ddd.admission.domain.model.question_specifique import QuestionSpecifique -from admission.ddd.admission.domain.model.titre_acces_selectionnable import TitreAccesSelectionnable -from admission.ddd.admission.domain.repository.i_titre_acces_selectionnable import ITitreAccesSelectionnableRepository -from admission.ddd.admission.domain.service.i_profil_candidat import IProfilCandidatTranslator -from admission.ddd.admission.domain.service.profil_candidat import ProfilCandidat as ProfilCandidatService -from admission.ddd.admission.domain.service.i_question_specifique import ISuperQuestionSpecifiqueTranslator -from admission.ddd.admission.domain.validator.exceptions import ExperienceNonTrouveeException +from admission.ddd.admission.domain.model.titre_acces_selectionnable import ( + TitreAccesSelectionnable, +) +from admission.ddd.admission.domain.repository.i_titre_acces_selectionnable import ( + ITitreAccesSelectionnableRepository, +) +from admission.ddd.admission.domain.service.i_profil_candidat import ( + IProfilCandidatTranslator, +) +from admission.ddd.admission.domain.service.i_question_specifique import ( + ISuperQuestionSpecifiqueTranslator, +) +from admission.ddd.admission.domain.service.profil_candidat import ( + ProfilCandidat as ProfilCandidatService, +) +from admission.ddd.admission.domain.validator.exceptions import ( + ExperienceNonTrouveeException, +) from admission.ddd.admission.dtos.emplacement_document import EmplacementDocumentDTO from admission.ddd.admission.enums import ( ChoixAssimilation1, @@ -129,11 +148,16 @@ from base.models.enums.academic_calendar_type import AcademicCalendarTypes from ddd.logic.financabilite.domain.model.enums.etat import EtatFinancabilite from ddd.logic.financabilite.domain.model.enums.situation import ( - SituationFinancabilite, SITUATION_FINANCABILITE_PAR_ETAT, + SituationFinancabilite, +) +from ddd.logic.reference.domain.model.bourse import BourseIdentity +from ddd.logic.shared_kernel.academic_year.repository.i_academic_year import ( + IAcademicYearRepository, +) +from ddd.logic.shared_kernel.profil.domain.service.parcours_interne import ( + IExperienceParcoursInterneTranslator, ) -from ddd.logic.shared_kernel.academic_year.repository.i_academic_year import IAcademicYearRepository -from ddd.logic.shared_kernel.profil.domain.service.parcours_interne import IExperienceParcoursInterneTranslator from epc.models.enums.condition_acces import ConditionAcces from osis_common.ddd import interface @@ -503,19 +527,19 @@ def completer_comptabilite( self.auteur_derniere_modification = auteur_modification self.comptabilite = Comptabilite( attestation_absence_dette_etablissement=attestation_absence_dette_etablissement, - type_situation_assimilation=TypeSituationAssimilation[type_situation_assimilation] - if type_situation_assimilation - else None, - sous_type_situation_assimilation_1=ChoixAssimilation1[sous_type_situation_assimilation_1] - if sous_type_situation_assimilation_1 - else None, + type_situation_assimilation=( + TypeSituationAssimilation[type_situation_assimilation] if type_situation_assimilation else None + ), + sous_type_situation_assimilation_1=( + ChoixAssimilation1[sous_type_situation_assimilation_1] if sous_type_situation_assimilation_1 else None + ), carte_resident_longue_duree=carte_resident_longue_duree, carte_cire_sejour_illimite_etranger=carte_cire_sejour_illimite_etranger, carte_sejour_membre_ue=carte_sejour_membre_ue, carte_sejour_permanent_membre_ue=carte_sejour_permanent_membre_ue, - sous_type_situation_assimilation_2=ChoixAssimilation2[sous_type_situation_assimilation_2] - if sous_type_situation_assimilation_2 - else None, + sous_type_situation_assimilation_2=( + ChoixAssimilation2[sous_type_situation_assimilation_2] if sous_type_situation_assimilation_2 else None + ), carte_a_b_refugie=carte_a_b_refugie, annexe_25_26_refugies_apatrides=annexe_25_26_refugies_apatrides, attestation_immatriculation=attestation_immatriculation, @@ -524,18 +548,18 @@ def completer_comptabilite( decision_protection_subsidiaire=decision_protection_subsidiaire, decision_protection_temporaire=decision_protection_temporaire, carte_a=carte_a, - sous_type_situation_assimilation_3=ChoixAssimilation3[sous_type_situation_assimilation_3] - if sous_type_situation_assimilation_3 - else None, + sous_type_situation_assimilation_3=( + ChoixAssimilation3[sous_type_situation_assimilation_3] if sous_type_situation_assimilation_3 else None + ), titre_sejour_3_mois_professionel=titre_sejour_3_mois_professionel, fiches_remuneration=fiches_remuneration, titre_sejour_3_mois_remplacement=titre_sejour_3_mois_remplacement, preuve_allocations_chomage_pension_indemnite=preuve_allocations_chomage_pension_indemnite, attestation_cpas=attestation_cpas, relation_parente=LienParente[relation_parente] if relation_parente else None, - sous_type_situation_assimilation_5=ChoixAssimilation5[sous_type_situation_assimilation_5] - if sous_type_situation_assimilation_5 - else None, + sous_type_situation_assimilation_5=( + ChoixAssimilation5[sous_type_situation_assimilation_5] if sous_type_situation_assimilation_5 else None + ), composition_menage_acte_naissance=composition_menage_acte_naissance, acte_tutelle=acte_tutelle, composition_menage_acte_mariage=composition_menage_acte_mariage, @@ -546,9 +570,9 @@ def completer_comptabilite( titre_sejour_3_mois_parent=titre_sejour_3_mois_parent, fiches_remuneration_parent=fiches_remuneration_parent, attestation_cpas_parent=attestation_cpas_parent, - sous_type_situation_assimilation_6=ChoixAssimilation6[sous_type_situation_assimilation_6] - if sous_type_situation_assimilation_6 - else None, + sous_type_situation_assimilation_6=( + ChoixAssimilation6[sous_type_situation_assimilation_6] if sous_type_situation_assimilation_6 else None + ), decision_bourse_cfwb=decision_bourse_cfwb, attestation_boursier=attestation_boursier, titre_identite_sejour_longue_duree_ue=titre_identite_sejour_longue_duree_ue, diff --git a/ddd/admission/doctorat/preparation/dtos/doctorat.py b/ddd/admission/doctorat/preparation/dtos/doctorat.py index 0a170c5ca..d24d057cd 100644 --- a/ddd/admission/doctorat/preparation/dtos/doctorat.py +++ b/ddd/admission/doctorat/preparation/dtos/doctorat.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ import attr -from admission.ddd.admission.dtos.bourse import BourseDTO +from ddd.logic.reference.dtos.bourse import BourseDTO from osis_common.ddd import interface diff --git a/ddd/admission/doctorat/preparation/dtos/proposition.py b/ddd/admission/doctorat/preparation/dtos/proposition.py index 32576e9a9..f284e14f5 100644 --- a/ddd/admission/doctorat/preparation/dtos/proposition.py +++ b/ddd/admission/doctorat/preparation/dtos/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,17 +31,17 @@ import attr from admission.ddd.admission.doctorat.preparation.dtos import CotutelleDTO -from admission.ddd.admission.dtos.bourse import BourseDTO from admission.ddd.admission.dtos.profil_candidat import ProfilCandidatDTO from admission.ddd.admission.enums.type_demande import TypeDemande -from ddd.logic.learning_unit.dtos import LearningUnitSearchDTO -from ddd.logic.learning_unit.dtos import PartimSearchDTO +from ddd.logic.learning_unit.dtos import LearningUnitSearchDTO, PartimSearchDTO +from ddd.logic.reference.dtos.bourse import BourseDTO from osis_common.ddd import interface from osis_profile import PLUS_5_ISO_CODES -from .motif_refus import MotifRefusDTO -from .doctorat_formation import DoctoratFormationDTO + from ..domain.model.enums import STATUTS_PROPOSITION_DOCTORALE_NON_SOUMISE from ..domain.model.enums.checklist import DroitsInscriptionMontant +from .doctorat_formation import DoctoratFormationDTO +from .motif_refus import MotifRefusDTO @attr.dataclass(slots=True) diff --git a/ddd/admission/doctorat/preparation/test/use_case/write/test_initier_proposition_service.py b/ddd/admission/doctorat/preparation/test/use_case/write/test_initier_proposition_service.py index 3c1e78584..dfc13d870 100644 --- a/ddd/admission/doctorat/preparation/test/use_case/write/test_initier_proposition_service.py +++ b/ddd/admission/doctorat/preparation/test/use_case/write/test_initier_proposition_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,12 +24,15 @@ # # ############################################################################## -from django.test import TestCase - import attr +from django.test import TestCase -from admission.ddd.admission.doctorat.preparation.commands import InitierPropositionCommand -from admission.ddd.admission.doctorat.preparation.domain.model._detail_projet import projet_non_rempli +from admission.ddd.admission.doctorat.preparation.commands import ( + InitierPropositionCommand, +) +from admission.ddd.admission.doctorat.preparation.domain.model._detail_projet import ( + projet_non_rempli, +) from admission.ddd.admission.doctorat.preparation.domain.model._experience_precedente_recherche import ( aucune_experience_precedente_recherche, ) @@ -40,10 +43,12 @@ ChoixCommissionProximiteCDEouCLSM, ChoixCommissionProximiteCDSS, ChoixSousDomaineSciences, - ChoixTypeAdmission, ChoixStatutPropositionDoctorale, + ChoixTypeAdmission, +) +from admission.ddd.admission.doctorat.preparation.domain.model.proposition import ( + Proposition, ) -from admission.ddd.admission.doctorat.preparation.domain.model.proposition import Proposition from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( CommissionProximiteInconsistantException, DoctoratNonTrouveException, @@ -53,19 +58,25 @@ from admission.ddd.admission.doctorat.preparation.test.factory.proposition import ( PropositionAdmissionSC3DPMinimaleAnnuleeFactory, ) -from admission.ddd.admission.domain.service.i_maximum_propositions import MAXIMUM_PROPOSITIONS_EN_COURS -from admission.ddd.admission.enums.type_bourse import TypeBourse +from admission.ddd.admission.domain.service.i_maximum_propositions import ( + MAXIMUM_PROPOSITIONS_EN_COURS, +) from admission.infrastructure.admission.doctorat.preparation.repository.in_memory.proposition import ( PropositionInMemoryRepository, ) -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) from base.ddd.utils.business_validator import MultipleBusinessExceptions +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) +from reference.models.enums.scholarship_type import ScholarshipType class TestInitierPropositionService(TestCase): @classmethod - def _get_une_bourse_par_type(cls, type_bourse: TypeBourse): + def _get_une_bourse_par_type(cls, type_bourse: ScholarshipType): return next( (bourse.entity_id.uuid for bourse in BourseInMemoryTranslator.ENTITIES if bourse.type == type_bourse), None, diff --git a/ddd/admission/doctorat/preparation/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py b/ddd/admission/doctorat/preparation/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py index 5e7f0ddec..957e07548 100644 --- a/ddd/admission/doctorat/preparation/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py +++ b/ddd/admission/doctorat/preparation/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,27 +29,26 @@ import attr from django.test import SimpleTestCase -from admission.ddd.admission.domain.validator.exceptions import BourseNonTrouveeException from admission.ddd.admission.doctorat.preparation.commands import ( - ModifierTypeAdmissionCommand, ModifierChoixFormationParGestionnaireCommand, ) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( ChoixCommissionProximiteCDEouCLSM, - ChoixTypeAdmission, ChoixCommissionProximiteCDSS, ChoixSousDomaineSciences, + ChoixTypeAdmission, ) from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( - PropositionNonTrouveeException, - JustificationRequiseException, CommissionProximiteInconsistantException, + JustificationRequiseException, + PropositionNonTrouveeException, ) -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator from admission.infrastructure.admission.doctorat.preparation.repository.in_memory.proposition import ( PropositionInMemoryRepository, ) -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) from base.ddd.utils.business_validator import MultipleBusinessExceptions diff --git a/ddd/admission/doctorat/preparation/use_case/write/completer_proposition_service.py b/ddd/admission/doctorat/preparation/use_case/write/completer_proposition_service.py index 9b57624bd..329203157 100644 --- a/ddd/admission/doctorat/preparation/use_case/write/completer_proposition_service.py +++ b/ddd/admission/doctorat/preparation/use_case/write/completer_proposition_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,13 +23,25 @@ # see http://www.gnu.org/licenses/. # # ############################################################################## -from admission.ddd.admission.doctorat.preparation.builder.proposition_identity_builder import PropositionIdentityBuilder -from admission.ddd.admission.doctorat.preparation.commands import CompleterPropositionCommand -from admission.ddd.admission.doctorat.preparation.domain.model.proposition import PropositionIdentity -from admission.ddd.admission.doctorat.preparation.domain.service.i_doctorat import IDoctoratTranslator -from admission.ddd.admission.doctorat.preparation.domain.service.i_historique import IHistorique -from admission.ddd.admission.doctorat.preparation.repository.i_proposition import IPropositionRepository -from admission.ddd.admission.domain.builder.bourse_identity import BourseIdentityBuilder +from admission.ddd.admission.doctorat.preparation.builder.proposition_identity_builder import ( + PropositionIdentityBuilder, +) +from admission.ddd.admission.doctorat.preparation.commands import ( + CompleterPropositionCommand, +) +from admission.ddd.admission.doctorat.preparation.domain.model.proposition import ( + PropositionIdentity, +) +from admission.ddd.admission.doctorat.preparation.domain.service.i_doctorat import ( + IDoctoratTranslator, +) +from admission.ddd.admission.doctorat.preparation.domain.service.i_historique import ( + IHistorique, +) +from admission.ddd.admission.doctorat.preparation.repository.i_proposition import ( + IPropositionRepository, +) +from ddd.logic.reference.domain.builder.bourse_identity import BourseIdentityBuilder def completer_proposition( diff --git a/ddd/admission/domain/builder/bourse_identity.py b/ddd/admission/domain/builder/bourse_identity.py deleted file mode 100644 index e690afd02..000000000 --- a/ddd/admission/domain/builder/bourse_identity.py +++ /dev/null @@ -1,41 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -from admission.ddd.admission.domain.model.bourse import BourseIdentity -from osis_common.ddd.interface import EntityIdentityBuilder, CommandRequest, DTO - - -class BourseIdentityBuilder(EntityIdentityBuilder): - @classmethod - def build_from_command(cls, cmd: 'CommandRequest') -> 'BourseIdentity': - raise NotImplementedError - - @classmethod - def build_from_repository_dto(cls, dto_object: 'DTO') -> 'BourseIdentity': - raise NotImplementedError - - @classmethod - def build_from_uuid(cls, uuid: str) -> 'BourseIdentity': - return BourseIdentity(uuid=uuid) diff --git a/ddd/admission/domain/model/bourse.py b/ddd/admission/domain/model/bourse.py deleted file mode 100644 index 7ceb32eb5..000000000 --- a/ddd/admission/domain/model/bourse.py +++ /dev/null @@ -1,33 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -import attr - -from osis_common.ddd import interface - - -@attr.dataclass(frozen=True, slots=True) -class BourseIdentity(interface.EntityIdentity): - uuid: str diff --git a/ddd/admission/domain/service/i_bourse.py b/ddd/admission/domain/service/i_bourse.py deleted file mode 100644 index f863ad387..000000000 --- a/ddd/admission/domain/service/i_bourse.py +++ /dev/null @@ -1,58 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -from abc import abstractmethod -from typing import List, Dict - -from admission.ddd.admission.domain.model.bourse import BourseIdentity -from admission.ddd.admission.dtos.bourse import BourseDTO -from osis_common.ddd import interface - - -class IBourseTranslator(interface.DomainService): - @classmethod - @abstractmethod - def get(cls, uuid: str) -> BourseIdentity: - raise NotImplementedError - - @classmethod - @abstractmethod - def get_dto(cls, uuid: str) -> BourseDTO: - raise NotImplementedError - - @classmethod - @abstractmethod - def search(cls, uuids: List[str]) -> Dict[str, BourseIdentity]: - raise NotImplementedError - - @classmethod - @abstractmethod - def search_dto(cls, entity_ids: BourseIdentity) -> Dict[str, BourseDTO]: - raise NotImplementedError - - @classmethod - @abstractmethod - def verifier_existence(cls, uuid: str) -> bool: - raise NotImplementedError diff --git a/ddd/admission/domain/validator/exceptions.py b/ddd/admission/domain/validator/exceptions.py index a9ac28892..dbbb2fdf5 100644 --- a/ddd/admission/domain/validator/exceptions.py +++ b/ddd/admission/domain/validator/exceptions.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,14 +31,6 @@ from osis_common.ddd.interface import BusinessException -class BourseNonTrouveeException(BusinessException): - status_code = "ADMISSION-1" - - def __init__(self, **kwargs): - message = _("No scholarship found.") - super().__init__(message, **kwargs) - - class ConditionsAccessNonRempliesException(BusinessException): status_code = "ADMISSION-2" diff --git a/ddd/admission/dtos/bourse.py b/ddd/admission/dtos/bourse.py deleted file mode 100644 index d8728e6b7..000000000 --- a/ddd/admission/dtos/bourse.py +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -############################################################################## -import attr - -from osis_common.ddd import interface - - -@attr.dataclass(frozen=True, slots=True) -class BourseDTO(interface.DTO): - uuid: str - nom_court: str - nom_long: str - type: str - - def __str__(self): - return self.nom_long or self.nom_court diff --git a/ddd/admission/enums/__init__.py b/ddd/admission/enums/__init__.py index eb64628f9..8093eb177 100644 --- a/ddd/admission/enums/__init__.py +++ b/ddd/admission/enums/__init__.py @@ -25,4 +25,3 @@ # ############################################################################## from .comptabilite import * from .question_specifique import * -from .type_bourse import TypeBourse diff --git a/ddd/admission/enums/type_bourse.py b/ddd/admission/enums/type_bourse.py deleted file mode 100644 index 281998a0b..000000000 --- a/ddd/admission/enums/type_bourse.py +++ /dev/null @@ -1,35 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -from django.utils.translation import gettext_lazy as _ - -from base.models.utils.utils import ChoiceEnum - - -class TypeBourse(ChoiceEnum): - DOUBLE_TRIPLE_DIPLOMATION = _('Dual or triple degree') - BOURSE_INTERNATIONALE_DOCTORAT = _('International for doctorate') - BOURSE_INTERNATIONALE_FORMATION_GENERALE = _('International for general education') - ERASMUS_MUNDUS = _('Erasmus Mundus') diff --git a/ddd/admission/formation_generale/domain/builder/proposition_builder.py b/ddd/admission/formation_generale/domain/builder/proposition_builder.py index c2c46b683..0adf2eaa7 100644 --- a/ddd/admission/formation_generale/domain/builder/proposition_builder.py +++ b/ddd/admission/formation_generale/domain/builder/proposition_builder.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,13 +26,19 @@ from typing import Dict from admission.ddd.admission.domain.model.formation import FormationIdentity -from admission.ddd.admission.domain.service.i_bourse import BourseIdentity -from admission.ddd.admission.formation_generale.commands import InitierPropositionCommand +from admission.ddd.admission.formation_generale.commands import ( + InitierPropositionCommand, +) from admission.ddd.admission.formation_generale.domain.builder.proposition_identity_builder import ( PropositionIdentityBuilder, ) -from admission.ddd.admission.formation_generale.domain.model.proposition import Proposition -from admission.ddd.admission.formation_generale.repository.i_proposition import IPropositionRepository +from admission.ddd.admission.formation_generale.domain.model.proposition import ( + Proposition, +) +from admission.ddd.admission.formation_generale.repository.i_proposition import ( + IPropositionRepository, +) +from ddd.logic.reference.domain.model.bourse import BourseIdentity from osis_common.ddd import interface diff --git a/ddd/admission/formation_generale/domain/model/proposition.py b/ddd/admission/formation_generale/domain/model/proposition.py index 51c6bb89f..8b4756fbf 100644 --- a/ddd/admission/formation_generale/domain/model/proposition.py +++ b/ddd/admission/formation_generale/domain/model/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,93 +26,118 @@ import datetime from decimal import Decimal -from typing import Dict, Optional, List +from typing import Dict, List, Optional import attr from django.utils.timezone import now from django.utils.translation import gettext_noop as __ -from admission.ddd.admission.doctorat.preparation.dtos.curriculum import CurriculumAdmissionDTO +from admission.ddd.admission.doctorat.preparation.dtos.curriculum import ( + CurriculumAdmissionDTO, +) from admission.ddd.admission.domain.model._profil_candidat import ProfilCandidat -from admission.ddd.admission.domain.model.complement_formation import ComplementFormationIdentity +from admission.ddd.admission.domain.model.complement_formation import ( + ComplementFormationIdentity, +) from admission.ddd.admission.domain.model.condition_complementaire_approbation import ( ConditionComplementaireApprobationIdentity, ConditionComplementaireLibreApprobation, ) from admission.ddd.admission.domain.model.enums.equivalence import ( - TypeEquivalenceTitreAcces, - StatutEquivalenceTitreAcces, EtatEquivalenceTitreAcces, + StatutEquivalenceTitreAcces, + TypeEquivalenceTitreAcces, ) from admission.ddd.admission.domain.model.formation import FormationIdentity from admission.ddd.admission.domain.model.motif_refus import MotifRefusIdentity -from admission.ddd.admission.domain.model.poste_diplomatique import PosteDiplomatiqueIdentity +from admission.ddd.admission.domain.model.poste_diplomatique import ( + PosteDiplomatiqueIdentity, +) from admission.ddd.admission.domain.model.question_specifique import QuestionSpecifique -from admission.ddd.admission.domain.model.titre_acces_selectionnable import TitreAccesSelectionnable -from admission.ddd.admission.domain.repository.i_titre_acces_selectionnable import ITitreAccesSelectionnableRepository -from admission.ddd.admission.domain.service.i_bourse import BourseIdentity -from admission.ddd.admission.domain.service.i_profil_candidat import IProfilCandidatTranslator -from admission.ddd.admission.domain.service.i_question_specifique import ISuperQuestionSpecifiqueTranslator -from admission.ddd.admission.domain.service.profil_candidat import ProfilCandidat as ProfilCandidatService -from admission.ddd.admission.domain.validator.exceptions import ExperienceNonTrouveeException +from admission.ddd.admission.domain.model.titre_acces_selectionnable import ( + TitreAccesSelectionnable, +) +from admission.ddd.admission.domain.repository.i_titre_acces_selectionnable import ( + ITitreAccesSelectionnableRepository, +) +from admission.ddd.admission.domain.service.i_profil_candidat import ( + IProfilCandidatTranslator, +) +from admission.ddd.admission.domain.service.i_question_specifique import ( + ISuperQuestionSpecifiqueTranslator, +) +from admission.ddd.admission.domain.service.profil_candidat import ( + ProfilCandidat as ProfilCandidatService, +) +from admission.ddd.admission.domain.validator.exceptions import ( + ExperienceNonTrouveeException, +) from admission.ddd.admission.dtos.emplacement_document import EmplacementDocumentDTO from admission.ddd.admission.enums import ( - TypeSituationAssimilation, + ChoixAffiliationSport, ChoixAssimilation1, ChoixAssimilation2, ChoixAssimilation3, ChoixAssimilation5, ChoixAssimilation6, - ChoixAffiliationSport, ChoixTypeCompteBancaire, LienParente, + TypeSituationAssimilation, ) from admission.ddd.admission.enums.type_demande import TypeDemande -from admission.ddd.admission.formation_generale.domain.model._comptabilite import comptabilite_non_remplie, Comptabilite +from admission.ddd.admission.formation_generale.domain.model._comptabilite import ( + Comptabilite, + comptabilite_non_remplie, +) from admission.ddd.admission.formation_generale.domain.model.enums import ( - ChoixStatutPropositionGenerale, + BesoinDeDerogation, ChoixStatutChecklist, - PoursuiteDeCycle, + ChoixStatutPropositionGenerale, DecisionFacultaireEnum, - BesoinDeDerogation, - TypeDeRefus, DerogationFinancement, + PoursuiteDeCycle, + TypeDeRefus, ) from admission.ddd.admission.formation_generale.domain.model.statut_checklist import ( - StatutsChecklistGenerale, StatutChecklist, + StatutsChecklistGenerale, ) from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( CurriculumNonCompletePourAcceptationException, ) from admission.ddd.admission.formation_generale.domain.validator.validator_by_business_actions import ( - SICPeutSoumettreAFacLorsDeLaDecisionFacultaireValidatorList, - RefuserParFacValidatorList, + ApprouverAdmissionParSicValidatorList, + ApprouverInscriptionParSicValidatorList, + ApprouverInscriptionTardiveParFacValidatorList, ApprouverParFacValidatorList, - SpecifierNouvellesInformationsDecisionFacultaireValidatorList, + ApprouverParSicAValiderValidatorList, + ApprouverReorientationExterneParFacValidatorList, FacPeutSoumettreAuSicLorsDeLaDecisionFacultaireValidatorList, ModifierStatutChecklistParcoursAnterieurValidatorList, - RefuserParSicValidatorList, - ApprouverAdmissionParSicValidatorList, - ApprouverParSicAValiderValidatorList, + RefuserParFacValidatorList, RefuserParSicAValiderValidatorList, + RefuserParSicValidatorList, + SICPeutSoumettreAFacLorsDeLaDecisionFacultaireValidatorList, SicPeutSoumettreAuSicLorsDeLaDecisionFacultaireValidatorList, - ApprouverInscriptionTardiveParFacValidatorList, SpecifierConditionAccesParcoursAnterieurValidatorList, - ApprouverInscriptionParSicValidatorList, SpecifierInformationsApprobationInscriptionValidatorList, - ApprouverReorientationExterneParFacValidatorList, + SpecifierNouvellesInformationsDecisionFacultaireValidatorList, ) from admission.ddd.admission.utils import initialiser_checklist_experience from base.ddd.utils.business_validator import MultipleBusinessExceptions from base.models.enums.academic_calendar_type import AcademicCalendarTypes from ddd.logic.financabilite.domain.model.enums.etat import EtatFinancabilite from ddd.logic.financabilite.domain.model.enums.situation import ( - SituationFinancabilite, SITUATION_FINANCABILITE_PAR_ETAT, + SituationFinancabilite, +) +from ddd.logic.reference.domain.model.bourse import BourseIdentity +from ddd.logic.shared_kernel.academic_year.repository.i_academic_year import ( + IAcademicYearRepository, +) +from ddd.logic.shared_kernel.profil.domain.service.parcours_interne import ( + IExperienceParcoursInterneTranslator, ) -from ddd.logic.shared_kernel.academic_year.repository.i_academic_year import IAcademicYearRepository -from ddd.logic.shared_kernel.profil.domain.service.parcours_interne import IExperienceParcoursInterneTranslator from epc.models.enums.condition_acces import ConditionAcces from osis_common.ddd import interface @@ -613,19 +638,19 @@ def completer_comptabilite( enfant_personnel=enfant_personnel, attestation_enfant_personnel=attestation_enfant_personnel, preuve_statut_apatride=preuve_statut_apatride, - type_situation_assimilation=TypeSituationAssimilation[type_situation_assimilation] - if type_situation_assimilation - else None, - sous_type_situation_assimilation_1=ChoixAssimilation1[sous_type_situation_assimilation_1] - if sous_type_situation_assimilation_1 - else None, + type_situation_assimilation=( + TypeSituationAssimilation[type_situation_assimilation] if type_situation_assimilation else None + ), + sous_type_situation_assimilation_1=( + ChoixAssimilation1[sous_type_situation_assimilation_1] if sous_type_situation_assimilation_1 else None + ), carte_resident_longue_duree=carte_resident_longue_duree, carte_cire_sejour_illimite_etranger=carte_cire_sejour_illimite_etranger, carte_sejour_membre_ue=carte_sejour_membre_ue, carte_sejour_permanent_membre_ue=carte_sejour_permanent_membre_ue, - sous_type_situation_assimilation_2=ChoixAssimilation2[sous_type_situation_assimilation_2] - if sous_type_situation_assimilation_2 - else None, + sous_type_situation_assimilation_2=( + ChoixAssimilation2[sous_type_situation_assimilation_2] if sous_type_situation_assimilation_2 else None + ), carte_a_b_refugie=carte_a_b_refugie, annexe_25_26_refugies_apatrides=annexe_25_26_refugies_apatrides, attestation_immatriculation=attestation_immatriculation, @@ -633,18 +658,18 @@ def completer_comptabilite( decision_protection_subsidiaire=decision_protection_subsidiaire, decision_protection_temporaire=decision_protection_temporaire, carte_a=carte_a, - sous_type_situation_assimilation_3=ChoixAssimilation3[sous_type_situation_assimilation_3] - if sous_type_situation_assimilation_3 - else None, + sous_type_situation_assimilation_3=( + ChoixAssimilation3[sous_type_situation_assimilation_3] if sous_type_situation_assimilation_3 else None + ), titre_sejour_3_mois_professionel=titre_sejour_3_mois_professionel, fiches_remuneration=fiches_remuneration, titre_sejour_3_mois_remplacement=titre_sejour_3_mois_remplacement, preuve_allocations_chomage_pension_indemnite=preuve_allocations_chomage_pension_indemnite, attestation_cpas=attestation_cpas, relation_parente=LienParente[relation_parente] if relation_parente else None, - sous_type_situation_assimilation_5=ChoixAssimilation5[sous_type_situation_assimilation_5] - if sous_type_situation_assimilation_5 - else None, + sous_type_situation_assimilation_5=( + ChoixAssimilation5[sous_type_situation_assimilation_5] if sous_type_situation_assimilation_5 else None + ), composition_menage_acte_naissance=composition_menage_acte_naissance, acte_tutelle=acte_tutelle, composition_menage_acte_mariage=composition_menage_acte_mariage, @@ -655,9 +680,9 @@ def completer_comptabilite( titre_sejour_3_mois_parent=titre_sejour_3_mois_parent, fiches_remuneration_parent=fiches_remuneration_parent, attestation_cpas_parent=attestation_cpas_parent, - sous_type_situation_assimilation_6=ChoixAssimilation6[sous_type_situation_assimilation_6] - if sous_type_situation_assimilation_6 - else None, + sous_type_situation_assimilation_6=( + ChoixAssimilation6[sous_type_situation_assimilation_6] if sous_type_situation_assimilation_6 else None + ), decision_bourse_cfwb=decision_bourse_cfwb, attestation_boursier=attestation_boursier, titre_identite_sejour_longue_duree_ue=titre_identite_sejour_longue_duree_ue, diff --git a/ddd/admission/formation_generale/dtos/proposition.py b/ddd/admission/formation_generale/dtos/proposition.py index c6c584c0d..ebfcafd0b 100644 --- a/ddd/admission/formation_generale/dtos/proposition.py +++ b/ddd/admission/formation_generale/dtos/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,9 +29,7 @@ import attr -from admission.ddd.admission.dtos.bourse import BourseDTO -from admission.ddd.admission.dtos.formation import BaseFormationDTO -from admission.ddd.admission.dtos.formation import FormationDTO +from admission.ddd.admission.dtos.formation import BaseFormationDTO, FormationDTO from admission.ddd.admission.dtos.poste_diplomatique import PosteDiplomatiqueDTO from admission.ddd.admission.dtos.profil_candidat import ProfilCandidatDTO from admission.ddd.admission.enums.type_demande import TypeDemande @@ -39,9 +37,12 @@ STATUTS_PROPOSITION_GENERALE_NON_SOUMISE, DroitsInscriptionMontant, ) -from admission.ddd.admission.formation_generale.dtos.condition_approbation import ConditionComplementaireApprobationDTO +from admission.ddd.admission.formation_generale.dtos.condition_approbation import ( + ConditionComplementaireApprobationDTO, +) from admission.ddd.admission.formation_generale.dtos.motif_refus import MotifRefusDTO from ddd.logic.learning_unit.dtos import LearningUnitSearchDTO, PartimSearchDTO +from ddd.logic.reference.dtos.bourse import BourseDTO from osis_common.ddd import interface from osis_profile import PLUS_5_ISO_CODES diff --git a/ddd/admission/formation_generale/test/use_case/read/test_lister_propositions_candidat_service.py b/ddd/admission/formation_generale/test/use_case/read/test_lister_propositions_candidat_service.py index 8355b495f..c7336fb87 100644 --- a/ddd/admission/formation_generale/test/use_case/read/test_lister_propositions_candidat_service.py +++ b/ddd/admission/formation_generale/test/use_case/read/test_lister_propositions_candidat_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,11 +27,17 @@ from django.test import SimpleTestCase -from admission.ddd.admission.enums.type_bourse import TypeBourse -from admission.ddd.admission.formation_generale.commands import ListerPropositionsCandidatQuery -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale +from admission.ddd.admission.formation_generale.commands import ( + ListerPropositionsCandidatQuery, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) from admission.ddd.admission.formation_generale.dtos import PropositionDTO -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) +from reference.models.enums.scholarship_type import ScholarshipType class TestListerPropositionsCandidatService(SimpleTestCase): @@ -52,13 +58,13 @@ def test_should_rechercher_par_matricule(self): self.assertEqual(results[0].nom_candidat, 'Doe') self.assertEqual( results[0].bourse_internationale.type, - TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, + ScholarshipType.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, ) self.assertEqual(results[0].bourse_internationale.nom_court, 'AFEPA') self.assertEqual(results[0].bourse_internationale.nom_long, 'AFEPA --') - self.assertEqual(results[0].bourse_erasmus_mundus.type, TypeBourse.ERASMUS_MUNDUS.name) + self.assertEqual(results[0].bourse_erasmus_mundus.type, ScholarshipType.ERASMUS_MUNDUS.name) self.assertEqual(results[0].bourse_erasmus_mundus.nom_court, 'EMDI') self.assertEqual(results[0].bourse_erasmus_mundus.nom_long, 'EMDI --') - self.assertEqual(results[0].bourse_double_diplome.type, TypeBourse.DOUBLE_TRIPLE_DIPLOMATION.name) + self.assertEqual(results[0].bourse_double_diplome.type, ScholarshipType.DOUBLE_TRIPLE_DIPLOMATION.name) self.assertEqual(results[0].bourse_double_diplome.nom_court, 'AGRO DD UCLOUVAIN/GEM') self.assertEqual(results[0].bourse_double_diplome.nom_long, 'AGRO DD UCLOUVAIN/GEM --') diff --git a/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_gestionnaire_service.py b/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_gestionnaire_service.py index 6990e8ada..ca403a0f5 100644 --- a/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_gestionnaire_service.py +++ b/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_gestionnaire_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,11 +26,19 @@ from django.test import TestCase -from admission.ddd.admission.enums.type_bourse import TypeBourse -from admission.ddd.admission.formation_generale.commands import RecupererPropositionGestionnaireQuery -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale -from admission.ddd.admission.formation_generale.domain.validator.exceptions import PropositionNonTrouveeException -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.ddd.admission.formation_generale.commands import ( + RecupererPropositionGestionnaireQuery, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) +from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( + PropositionNonTrouveeException, +) +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) +from reference.models.enums.scholarship_type import ScholarshipType class RecupererPropositionGestionnaireServiceTestCase(TestCase): @@ -50,14 +58,14 @@ def test_get_proposition(self): self.assertEqual(result.nom_candidat, 'Smith') self.assertEqual( result.bourse_internationale.type, - TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, + ScholarshipType.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, ) self.assertEqual(result.bourse_internationale.nom_court, 'AFEPA') self.assertEqual(result.bourse_internationale.nom_long, 'AFEPA --') - self.assertEqual(result.bourse_erasmus_mundus.type, TypeBourse.ERASMUS_MUNDUS.name) + self.assertEqual(result.bourse_erasmus_mundus.type, ScholarshipType.ERASMUS_MUNDUS.name) self.assertEqual(result.bourse_erasmus_mundus.nom_court, 'EMDI') self.assertEqual(result.bourse_erasmus_mundus.nom_long, 'EMDI --') - self.assertEqual(result.bourse_double_diplome.type, TypeBourse.DOUBLE_TRIPLE_DIPLOMATION.name) + self.assertEqual(result.bourse_double_diplome.type, ScholarshipType.DOUBLE_TRIPLE_DIPLOMATION.name) self.assertEqual(result.bourse_double_diplome.nom_court, 'AGRO DD UCLOUVAIN/GEM') self.assertEqual(result.bourse_double_diplome.nom_long, 'AGRO DD UCLOUVAIN/GEM --') self.assertEqual(result.genre_candidat, 'H') diff --git a/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_service.py b/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_service.py index 706557931..edd550b97 100644 --- a/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_service.py +++ b/ddd/admission/formation_generale/test/use_case/read/test_recuperer_proposition_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,11 +26,19 @@ from django.test import SimpleTestCase -from admission.ddd.admission.formation_generale.domain.validator.exceptions import PropositionNonTrouveeException -from admission.ddd.admission.enums.type_bourse import TypeBourse -from admission.ddd.admission.formation_generale.commands import RecupererPropositionQuery -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.ddd.admission.formation_generale.commands import ( + RecupererPropositionQuery, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) +from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( + PropositionNonTrouveeException, +) +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) +from reference.models.enums.scholarship_type import ScholarshipType class RecupererPropositionServiceTestCase(SimpleTestCase): @@ -50,14 +58,14 @@ def test_get_proposition(self): self.assertEqual(result.nom_candidat, 'Smith') self.assertEqual( result.bourse_internationale.type, - TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, + ScholarshipType.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, ) self.assertEqual(result.bourse_internationale.nom_court, 'AFEPA') self.assertEqual(result.bourse_internationale.nom_long, 'AFEPA --') - self.assertEqual(result.bourse_erasmus_mundus.type, TypeBourse.ERASMUS_MUNDUS.name) + self.assertEqual(result.bourse_erasmus_mundus.type, ScholarshipType.ERASMUS_MUNDUS.name) self.assertEqual(result.bourse_erasmus_mundus.nom_court, 'EMDI') self.assertEqual(result.bourse_erasmus_mundus.nom_long, 'EMDI --') - self.assertEqual(result.bourse_double_diplome.type, TypeBourse.DOUBLE_TRIPLE_DIPLOMATION.name) + self.assertEqual(result.bourse_double_diplome.type, ScholarshipType.DOUBLE_TRIPLE_DIPLOMATION.name) self.assertEqual(result.bourse_double_diplome.nom_court, 'AGRO DD UCLOUVAIN/GEM') self.assertEqual(result.bourse_double_diplome.nom_long, 'AGRO DD UCLOUVAIN/GEM --') diff --git a/ddd/admission/formation_generale/test/use_case/write/test_initier_proposition_service.py b/ddd/admission/formation_generale/test/use_case/write/test_initier_proposition_service.py index 5d73a8440..58412ea38 100644 --- a/ddd/admission/formation_generale/test/use_case/write/test_initier_proposition_service.py +++ b/ddd/admission/formation_generale/test/use_case/write/test_initier_proposition_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,22 +28,34 @@ import attr from django.test import SimpleTestCase -from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import MaximumPropositionsAtteintException -from admission.ddd.admission.domain.validator.exceptions import BourseNonTrouveeException -from admission.ddd.admission.enums.type_bourse import TypeBourse -from admission.ddd.admission.formation_generale.commands import InitierPropositionCommand -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale -from admission.ddd.admission.formation_generale.domain.validator.exceptions import FormationNonTrouveeException -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator +from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( + MaximumPropositionsAtteintException, +) +from admission.ddd.admission.formation_generale.commands import ( + InitierPropositionCommand, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) +from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( + FormationNonTrouveeException, +) from admission.infrastructure.admission.formation_generale.repository.in_memory.proposition import ( PropositionInMemoryRepository, ) -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) +from ddd.logic.reference.domain.validator.exceptions import BourseNonTrouveeException +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) +from reference.models.enums.scholarship_type import ScholarshipType class TestInitierPropositionService(SimpleTestCase): @classmethod - def _get_une_bourse_par_type(cls, type_bourse: TypeBourse): + def _get_une_bourse_par_type(cls, type_bourse: ScholarshipType): return next( (bourse.entity_id.uuid for bourse in BourseInMemoryTranslator.ENTITIES if bourse.type == type_bourse), None, @@ -58,9 +70,11 @@ def setUp(self) -> None: sigle_formation='MASTER-SCI', annee_formation=2020, matricule_candidat='01234567', - bourse_erasmus_mundus=self._get_une_bourse_par_type(TypeBourse.ERASMUS_MUNDUS), - bourse_internationale=self._get_une_bourse_par_type(TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE), - bourse_double_diplome=self._get_une_bourse_par_type(TypeBourse.DOUBLE_TRIPLE_DIPLOMATION), + bourse_erasmus_mundus=self._get_une_bourse_par_type(ScholarshipType.ERASMUS_MUNDUS), + bourse_internationale=self._get_une_bourse_par_type( + ScholarshipType.BOURSE_INTERNATIONALE_FORMATION_GENERALE + ), + bourse_double_diplome=self._get_une_bourse_par_type(ScholarshipType.DOUBLE_TRIPLE_DIPLOMATION), ) def test_should_initier(self): diff --git a/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py b/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py index 11975db39..36c2dce2c 100644 --- a/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py +++ b/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_par_gestionnaire_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,17 +28,25 @@ import attr from django.test import SimpleTestCase -from admission.ddd.admission.domain.validator.exceptions import BourseNonTrouveeException -from admission.ddd.admission.formation_generale.commands import ModifierChoixFormationParGestionnaireCommand -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale +from admission.ddd.admission.formation_generale.commands import ( + ModifierChoixFormationParGestionnaireCommand, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( PropositionNonTrouveeException, ) -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator from admission.infrastructure.admission.formation_generale.repository.in_memory.proposition import ( PropositionInMemoryRepository, ) -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) +from ddd.logic.reference.domain.validator.exceptions import BourseNonTrouveeException +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) class TestModifierChoixFormationParGestionnaireService(SimpleTestCase): diff --git a/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_service.py b/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_service.py index b4006757b..01e317ebd 100644 --- a/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_service.py +++ b/ddd/admission/formation_generale/test/use_case/write/test_modifier_choix_formation_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,18 +28,26 @@ import attr from django.test import SimpleTestCase -from admission.ddd.admission.domain.validator.exceptions import BourseNonTrouveeException -from admission.ddd.admission.formation_generale.commands import ModifierChoixFormationCommand -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale +from admission.ddd.admission.formation_generale.commands import ( + ModifierChoixFormationCommand, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( - PropositionNonTrouveeException, FormationNonTrouveeException, + PropositionNonTrouveeException, ) -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator from admission.infrastructure.admission.formation_generale.repository.in_memory.proposition import ( PropositionInMemoryRepository, ) -from admission.infrastructure.message_bus_in_memory import message_bus_in_memory_instance +from admission.infrastructure.message_bus_in_memory import ( + message_bus_in_memory_instance, +) +from ddd.logic.reference.domain.validator.exceptions import BourseNonTrouveeException +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) class TestModifierChoixFormationPropositionService(SimpleTestCase): diff --git a/ddd/admission/formation_generale/use_case/write/initier_proposition_service.py b/ddd/admission/formation_generale/use_case/write/initier_proposition_service.py index ce67b7e70..493b569ee 100644 --- a/ddd/admission/formation_generale/use_case/write/initier_proposition_service.py +++ b/ddd/admission/formation_generale/use_case/write/initier_proposition_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,15 +23,29 @@ # see http://www.gnu.org/licenses/. # ############################################################################## -from admission.ddd.admission.domain.builder.formation_identity import FormationIdentityBuilder -from admission.ddd.admission.domain.service.i_bourse import IBourseTranslator +from admission.ddd.admission.domain.builder.formation_identity import ( + FormationIdentityBuilder, +) from admission.ddd.admission.domain.service.i_historique import IHistorique -from admission.ddd.admission.domain.service.i_maximum_propositions import IMaximumPropositionsAutorisees -from admission.ddd.admission.formation_generale.commands import InitierPropositionCommand -from admission.ddd.admission.formation_generale.domain.builder.proposition_builder import PropositionBuilder -from admission.ddd.admission.formation_generale.domain.model.proposition import PropositionIdentity -from admission.ddd.admission.formation_generale.domain.service.i_formation import IFormationGeneraleTranslator -from admission.ddd.admission.formation_generale.repository.i_proposition import IPropositionRepository +from admission.ddd.admission.domain.service.i_maximum_propositions import ( + IMaximumPropositionsAutorisees, +) +from admission.ddd.admission.formation_generale.commands import ( + InitierPropositionCommand, +) +from admission.ddd.admission.formation_generale.domain.builder.proposition_builder import ( + PropositionBuilder, +) +from admission.ddd.admission.formation_generale.domain.model.proposition import ( + PropositionIdentity, +) +from admission.ddd.admission.formation_generale.domain.service.i_formation import ( + IFormationGeneraleTranslator, +) +from admission.ddd.admission.formation_generale.repository.i_proposition import ( + IPropositionRepository, +) +from ddd.logic.reference.domain.service.i_bourse import IBourseTranslator def initier_proposition( diff --git a/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_par_gestionnaire_service.py b/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_par_gestionnaire_service.py index 459e3026f..be198b843 100644 --- a/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_par_gestionnaire_service.py +++ b/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_par_gestionnaire_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,14 +23,22 @@ # see http://www.gnu.org/licenses/. # ############################################################################## -from admission.ddd.admission.domain.service.i_bourse import IBourseTranslator -from admission.ddd.admission.formation_generale.commands import ModifierChoixFormationParGestionnaireCommand +from admission.ddd.admission.formation_generale.commands import ( + ModifierChoixFormationParGestionnaireCommand, +) from admission.ddd.admission.formation_generale.domain.builder.proposition_identity_builder import ( PropositionIdentityBuilder, ) -from admission.ddd.admission.formation_generale.domain.model.proposition import PropositionIdentity -from admission.ddd.admission.formation_generale.events import FormationDuDossierAdmissionModifieeEvent -from admission.ddd.admission.formation_generale.repository.i_proposition import IPropositionRepository +from admission.ddd.admission.formation_generale.domain.model.proposition import ( + PropositionIdentity, +) +from admission.ddd.admission.formation_generale.events import ( + FormationDuDossierAdmissionModifieeEvent, +) +from admission.ddd.admission.formation_generale.repository.i_proposition import ( + IPropositionRepository, +) +from ddd.logic.reference.domain.service.i_bourse import IBourseTranslator def modifier_choix_formation_par_gestionnaire( diff --git a/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_service.py b/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_service.py index 69c1f9951..b3afb452e 100644 --- a/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_service.py +++ b/ddd/admission/formation_generale/use_case/write/modifier_choix_formation_service.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,15 +23,25 @@ # see http://www.gnu.org/licenses/. # ############################################################################## -from admission.ddd.admission.domain.builder.formation_identity import FormationIdentityBuilder -from admission.ddd.admission.domain.service.i_bourse import IBourseTranslator -from admission.ddd.admission.formation_generale.commands import ModifierChoixFormationCommand +from admission.ddd.admission.domain.builder.formation_identity import ( + FormationIdentityBuilder, +) +from admission.ddd.admission.formation_generale.commands import ( + ModifierChoixFormationCommand, +) from admission.ddd.admission.formation_generale.domain.builder.proposition_identity_builder import ( PropositionIdentityBuilder, ) -from admission.ddd.admission.formation_generale.domain.model.proposition import PropositionIdentity -from admission.ddd.admission.formation_generale.domain.service.i_formation import IFormationGeneraleTranslator -from admission.ddd.admission.formation_generale.repository.i_proposition import IPropositionRepository +from admission.ddd.admission.formation_generale.domain.model.proposition import ( + PropositionIdentity, +) +from admission.ddd.admission.formation_generale.domain.service.i_formation import ( + IFormationGeneraleTranslator, +) +from admission.ddd.admission.formation_generale.repository.i_proposition import ( + IPropositionRepository, +) +from ddd.logic.reference.domain.service.i_bourse import IBourseTranslator def modifier_choix_formation( diff --git a/ddd/admission/test/factory/bourse.py b/ddd/admission/test/factory/bourse.py index 619b67ddd..93d71a2e0 100644 --- a/ddd/admission/test/factory/bourse.py +++ b/ddd/admission/test/factory/bourse.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -23,10 +23,11 @@ # see http://www.gnu.org/licenses/. # # ############################################################################## -import factory import uuid -from admission.ddd.admission.domain.service.i_bourse import BourseIdentity +import factory + +from ddd.logic.reference.domain.model.bourse import BourseIdentity class BourseIdentityFactory(factory.Factory): diff --git a/forms/__init__.py b/forms/__init__.py index 81cae57cf..55f9e6cbf 100644 --- a/forms/__init__.py +++ b/forms/__init__.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,7 +25,7 @@ # ############################################################################## import datetime import html -from typing import List, Optional, Dict, Union, Mapping +from typing import Dict, List, Mapping, Optional, Union import phonenumbers from dal import forward @@ -33,16 +33,18 @@ from django.conf import settings from django.core.exceptions import ValidationError from django.utils.safestring import mark_safe -from django.utils.translation import gettext_lazy as _, get_language, pgettext_lazy +from django.utils.translation import get_language +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import pgettext_lazy from admission.ddd.admission.dtos.formation import FormationDTO -from admission.ddd.admission.enums import TypeBourse from base.forms.utils import EMPTY_CHOICE, autocomplete from base.models.academic_year import AcademicYear from base.models.campus import Campus from education_group.forms.fields import MainCampusChoiceField from education_group.templatetags.education_group_extra import format_to_academic_year from reference.models.country import Country +from reference.models.enums.scholarship_type import ScholarshipType NONE_CHOICE = ((None, ' - '),) ALL_EMPTY_CHOICE = (('', _('All')),) @@ -186,7 +188,7 @@ def get_year_choices(min_year=1920, max_year=None, full_format=False, empty_labe return [('', empty_label)] + [(year, year) for year in year_range] -def get_scholarship_choices(scholarships, scholarship_type: TypeBourse): +def get_scholarship_choices(scholarships, scholarship_type: ScholarshipType): """ Return the list of choices of a scholarship choice field. :param scholarships: The queryset containing the scholarships diff --git a/forms/admission/doctorate/project.py b/forms/admission/doctorate/project.py index ad3be1326..81d61b130 100644 --- a/forms/admission/doctorate/project.py +++ b/forms/admission/doctorate/project.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,27 +24,27 @@ # # ############################################################################## -from dal import forward, autocomplete +from dal import autocomplete, forward from django import forms from django.utils.translation import gettext_lazy as _ from osis_document.contrib import FileUploadField from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( - ChoixTypeFinancement, - ChoixTypeContratTravail, ChoixDoctoratDejaRealise, + ChoixTypeContratTravail, + ChoixTypeFinancement, ) -from admission.ddd.admission.enums import TypeBourse from admission.forms import SelectOrOtherField from admission.utils import ( - get_thesis_location_initial_choices, - get_scholarship_initial_choices, get_language_initial_choices, + get_scholarship_initial_choices, + get_thesis_location_initial_choices, ) from base.forms.utils import EMPTY_CHOICE from base.forms.utils.datefield import CustomDateInput from base.forms.utils.fields import RadioBooleanField from base.utils.mark_safe_lazy import mark_safe_lazy +from reference.models.enums.scholarship_type import ScholarshipType LANGUAGE_UNDECIDED = 'XX' @@ -94,7 +94,7 @@ class DoctorateAdmissionProjectForm(forms.Form): required=False, widget=autocomplete.ListSelect2( url='admission:autocomplete:scholarship', - forward=[forward.Const(TypeBourse.BOURSE_INTERNATIONALE_DOCTORAT.name, 'scholarship_type')], + forward=[forward.Const(ScholarshipType.BOURSE_INTERNATIONALE_DOCTORAT.name, 'scholarship_type')], ), ) autre_bourse_recherche = forms.CharField( diff --git a/forms/admission/filter.py b/forms/admission/filter.py index fcaa7dd23..434d7ebc3 100644 --- a/forms/admission/filter.py +++ b/forms/admission/filter.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,15 +26,19 @@ import re from django import forms -from django.utils.translation import gettext_lazy as _, ngettext, pgettext_lazy, get_language +from django.utils.translation import get_language +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import ngettext, pgettext_lazy from admission.constants import DEFAULT_PAGINATOR_SIZE -from admission.ddd.admission.enums import TypeBourse from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist from admission.ddd.admission.enums.liste import TardiveModificationReorientationFiltre from admission.ddd.admission.enums.statut import CHOIX_STATUT_TOUTE_PROPOSITION from admission.ddd.admission.enums.type_demande import TypeDemande -from admission.ddd.admission.formation_continue.domain.model.enums import ChoixStatutPropositionContinue, ChoixEdition +from admission.ddd.admission.formation_continue.domain.model.enums import ( + ChoixEdition, + ChoixStatutPropositionContinue, +) from admission.ddd.admission.formation_continue.domain.model.statut_checklist import ( ORGANISATION_ONGLETS_CHECKLIST as ORGANISATION_ONGLETS_CHECKLIST_CONTINUE, ) @@ -43,18 +47,19 @@ ) from admission.forms import ( ALL_EMPTY_CHOICE, - get_academic_year_choices, DEFAULT_AUTOCOMPLETE_WIDGET_ATTRS, NullBooleanSelectField, + get_academic_year_choices, ) from admission.forms.checklist_state_filter import ChecklistStateFilterField from admission.infrastructure.admission.domain.service.annee_inscription_formation import ( AnneeInscriptionFormationTranslator, ) -from admission.models import Scholarship -from admission.models.working_list import WorkingList, ContinuingWorkingList -from admission.views.autocomplete.trainings import ContinuingManagedEducationTrainingsAutocomplete -from base.forms.utils import autocomplete, EMPTY_CHOICE +from admission.models.working_list import ContinuingWorkingList, WorkingList +from admission.views.autocomplete.trainings import ( + ContinuingManagedEducationTrainingsAutocomplete, +) +from base.forms.utils import EMPTY_CHOICE, autocomplete from base.forms.widgets import Select2MultipleCheckboxesWidget from base.models.entity_version import EntityVersion from base.models.enums.academic_calendar_type import AcademicCalendarTypes @@ -62,6 +67,8 @@ from base.models.person import Person from base.templatetags.pagination_bs5 import PAGINATOR_SIZE_LIST from education_group.forms.fields import MainCampusChoiceField +from reference.models.enums.scholarship_type import ScholarshipType +from reference.models.scholarship import Scholarship REGEX_REFERENCE = r'\d{4}\.\d{4}$' @@ -223,11 +230,11 @@ class AllAdmissionsFilterForm(AdmissionFilterWithEntitiesAndTrainingTypesForm): scholarship_types_by_field = { 'bourse_internationale': { - TypeBourse.BOURSE_INTERNATIONALE_DOCTORAT.name, - TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, + ScholarshipType.BOURSE_INTERNATIONALE_DOCTORAT.name, + ScholarshipType.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, }, - 'bourse_erasmus_mundus': {TypeBourse.ERASMUS_MUNDUS.name}, - 'bourse_double_diplomation': {TypeBourse.DOUBLE_TRIPLE_DIPLOMATION.name}, + 'bourse_erasmus_mundus': {ScholarshipType.ERASMUS_MUNDUS.name}, + 'bourse_double_diplomation': {ScholarshipType.DOUBLE_TRIPLE_DIPLOMATION.name}, } noma = forms.RegexField( diff --git a/forms/admission/training_choice.py b/forms/admission/training_choice.py index 3f37f3028..feb361a82 100644 --- a/forms/admission/training_choice.py +++ b/forms/admission/training_choice.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -30,42 +30,53 @@ from django import forms from django.contrib.auth.models import User from django.utils.safestring import mark_safe -from django.utils.translation import gettext_lazy as _, pgettext_lazy +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import pgettext_lazy -from admission.models import Scholarship from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( COMMISSIONS_CDE_CLSM, COMMISSIONS_CDSS, SIGLES_SCIENCES, ) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( - ChoixTypeAdmission, ChoixCommissionProximiteCDEouCLSM, ChoixCommissionProximiteCDSS, ChoixSousDomaineSciences, + ChoixTypeAdmission, ) from admission.ddd.admission.doctorat.preparation.dtos import DoctoratFormationDTO from admission.ddd.admission.doctorat.preparation.dtos.proposition import ( PropositionGestionnaireDTO as PropositionDoctoraleDTO, ) from admission.ddd.admission.domain.enums import TypeFormation -from admission.ddd.admission.enums import TypeBourse -from admission.ddd.admission.formation_continue.domain.model.enums import ChoixMoyensDecouverteFormation -from admission.ddd.admission.formation_continue.dtos import PropositionDTO as PropositionContinueDTO +from admission.ddd.admission.formation_continue.domain.model.enums import ( + ChoixMoyensDecouverteFormation, +) +from admission.ddd.admission.formation_continue.dtos import ( + PropositionDTO as PropositionContinueDTO, +) from admission.ddd.admission.formation_generale.dtos.proposition import ( PropositionGestionnaireDTO as PropositionGeneraleDTO, ) -from admission.forms import get_scholarship_choices, format_training, AdmissionMainCampusChoiceField +from admission.forms import ( + AdmissionMainCampusChoiceField, + format_training, + get_scholarship_choices, +) from admission.forms.specific_question import ConfigurableFormMixin from admission.infrastructure.admission.domain.service.annee_inscription_formation import ( AnneeInscriptionFormationTranslator, ) -from admission.views.autocomplete.trainings import ContinuingManagedEducationTrainingsAutocomplete -from base.forms.utils import FIELD_REQUIRED_MESSAGE, EMPTY_CHOICE +from admission.views.autocomplete.trainings import ( + ContinuingManagedEducationTrainingsAutocomplete, +) +from base.forms.utils import EMPTY_CHOICE, FIELD_REQUIRED_MESSAGE from base.forms.utils.academic_year_field import AcademicYearModelChoiceField from base.forms.utils.fields import RadioBooleanField from base.models.education_group_year import EducationGroupYear from base.models.enums.state_iufc import StateIUFC +from reference.models.enums.scholarship_type import ScholarshipType +from reference.models.scholarship import Scholarship class BaseTrainingChoiceForm(ConfigurableFormMixin): @@ -163,9 +174,9 @@ def __init__(self, proposition: PropositionGeneraleDTO, user: User, *args, **kwa ) self.scholarship_fields = [ - ['double_degree_scholarship', TypeBourse.DOUBLE_TRIPLE_DIPLOMATION], - ['international_scholarship', TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE], - ['erasmus_mundus_scholarship', TypeBourse.ERASMUS_MUNDUS], + ['double_degree_scholarship', ScholarshipType.DOUBLE_TRIPLE_DIPLOMATION], + ['international_scholarship', ScholarshipType.BOURSE_INTERNATIONALE_FORMATION_GENERALE], + ['erasmus_mundus_scholarship', ScholarshipType.ERASMUS_MUNDUS], ] for scholarship_field, scholarship_type in self.scholarship_fields: @@ -304,9 +315,11 @@ def __init__(self, proposition: PropositionContinueDTO, user: User, *args, **kwa self.fields['continuing_education_training'].choices = [ ( selected_training, - self.continuing_training.formatted_title # type: ignore - if self.continuing_training - else selected_training, + ( + self.continuing_training.formatted_title # type: ignore + if self.continuing_training + else selected_training + ), ) ] diff --git a/forms/doctorate/cdd/filter.py b/forms/doctorate/cdd/filter.py index 220fe4e77..061bfb202 100644 --- a/forms/doctorate/cdd/filter.py +++ b/forms/doctorate/cdd/filter.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,41 +28,42 @@ from django import forms from django.conf import settings from django.db.models import Q -from django.utils.translation import get_language, gettext_lazy as _, pgettext_lazy +from django.utils.translation import get_language +from django.utils.translation import gettext_lazy as _ +from django.utils.translation import pgettext_lazy -from admission.models import EntityProxy, Scholarship -from admission.models.working_list import DoctorateWorkingList from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( ENTITY_CDE, ENTITY_CDSS, ENTITY_CLSM, - SIGLE_SCIENCES, ENTITY_SCIENCES, + SIGLE_SCIENCES, ) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( BourseRecherche, ChoixCommissionProximiteCDEouCLSM, ChoixCommissionProximiteCDSS, ChoixSousDomaineSciences, + ChoixStatutPropositionDoctorale, ChoixTypeAdmission, ChoixTypeFinancement, - ChoixStatutPropositionDoctorale, ) -from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist -from admission.ddd.admission.enums.type_bourse import TypeBourse from admission.ddd.admission.doctorat.preparation.domain.model.statut_checklist import ( ORGANISATION_ONGLETS_CHECKLIST_POUR_LISTING, ) +from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist from admission.forms import ( - DEFAULT_AUTOCOMPLETE_WIDGET_ATTRS, ALL_EMPTY_CHOICE, ALL_FEMININE_EMPTY_CHOICE, + DEFAULT_AUTOCOMPLETE_WIDGET_ATTRS, ) from admission.forms.admission.filter import BaseAdmissionFilterForm, WorkingListField from admission.forms.checklist_state_filter import ChecklistStateFilterField from admission.infrastructure.admission.domain.service.annee_inscription_formation import ( AnneeInscriptionFormationTranslator, ) +from admission.models import EntityProxy +from admission.models.working_list import DoctorateWorkingList from base.forms.utils import autocomplete from base.forms.utils.datefield import DatePickerInput from base.models.education_group_year import EducationGroupYear @@ -74,6 +75,8 @@ from osis_role.contrib.models import EntityRoleModel from osis_role.contrib.permissions import _get_relevant_roles from reference.models.country import Country +from reference.models.enums.scholarship_type import ScholarshipType +from reference.models.scholarship import Scholarship class DoctorateListFilterForm(BaseAdmissionFilterForm): @@ -256,7 +259,7 @@ def get_proximity_commission_choices(self): def get_scholarship_choices(self): doctorate_scholarships = Scholarship.objects.filter( - type=TypeBourse.BOURSE_INTERNATIONALE_DOCTORAT.name, + type=ScholarshipType.BOURSE_INTERNATIONALE_DOCTORAT.name, ).order_by('short_name') return ( diff --git a/infrastructure/admission/doctorat/preparation/handlers_in_memory.py b/infrastructure/admission/doctorat/preparation/handlers_in_memory.py index e493b80da..722e696b8 100644 --- a/infrastructure/admission/doctorat/preparation/handlers_in_memory.py +++ b/infrastructure/admission/doctorat/preparation/handlers_in_memory.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,38 +25,85 @@ # ############################################################################## from admission.ddd.admission.doctorat.preparation.commands import * -from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import OngletsChecklist +from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( + OngletsChecklist, +) from admission.ddd.admission.doctorat.preparation.use_case.read import * -from admission.ddd.admission.doctorat.preparation.use_case.read.recuperer_doctorat_service import recuperer_doctorat +from admission.ddd.admission.doctorat.preparation.use_case.read.recuperer_doctorat_service import ( + recuperer_doctorat, +) from admission.ddd.admission.doctorat.preparation.use_case.write import * from admission.ddd.admission.doctorat.preparation.use_case.write.redonner_la_main_au_candidat_service import ( redonner_la_main_au_candidat, ) -from admission.ddd.admission.use_case.read import recuperer_questions_specifiques_proposition +from admission.ddd.admission.use_case.read import ( + recuperer_questions_specifiques_proposition, +) from admission.ddd.admission.use_case.write import ( - initialiser_emplacement_document_libre_non_reclamable, - initialiser_emplacement_document_libre_a_reclamer, - initialiser_emplacement_document_a_reclamer, annuler_reclamation_emplacement_document, + initialiser_emplacement_document_a_reclamer, + initialiser_emplacement_document_libre_a_reclamer, + initialiser_emplacement_document_libre_non_reclamable, modifier_reclamation_emplacement_document, - supprimer_emplacement_document, remplacer_emplacement_document, remplir_emplacement_document_par_gestionnaire, + supprimer_emplacement_document, ) from admission.infrastructure.admission.domain.service.in_memory.annee_inscription_formation import ( AnneeInscriptionFormationInMemoryTranslator, ) -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator -from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ProfilCandidatInMemoryTranslator -from infrastructure.financabilite.domain.service.in_memory.financabilite import FinancabiliteInMemoryFetcher -from infrastructure.shared_kernel.academic_year.repository.in_memory.academic_year import AcademicYearInMemoryRepository -from infrastructure.shared_kernel.campus.repository.in_memory.campus import UclouvainCampusInMemoryRepository +from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ( + ProfilCandidatInMemoryTranslator, +) +from infrastructure.financabilite.domain.service.in_memory.financabilite import ( + FinancabiliteInMemoryFetcher, +) +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) +from infrastructure.shared_kernel.academic_year.repository.in_memory.academic_year import ( + AcademicYearInMemoryRepository, +) +from infrastructure.shared_kernel.campus.repository.in_memory.campus import ( + UclouvainCampusInMemoryRepository, +) from infrastructure.shared_kernel.personne_connue_ucl.in_memory.personne_connue_ucl import ( PersonneConnueUclInMemoryTranslator, ) from infrastructure.shared_kernel.profil.domain.service.in_memory.parcours_interne import ( ExperienceParcoursInterneInMemoryTranslator, ) + +from ...domain.service.in_memory.calendrier_inscription import ( + CalendrierInscriptionInMemory, +) +from ...domain.service.in_memory.elements_confirmation import ( + ElementsConfirmationInMemory, +) +from ...domain.service.in_memory.historique import ( + HistoriqueInMemory as HistoriqueGlobalInMemory, +) +from ...domain.service.in_memory.maximum_propositions import ( + MaximumPropositionsAutoriseesInMemory, +) +from ...domain.service.in_memory.recuperer_documents_proposition import ( + EmplacementsDocumentsPropositionInMemoryTranslator, +) +from ...domain.service.in_memory.titres_acces import TitresAccesInMemory +from ...domain.service.in_memory.unites_enseignement_translator import ( + UnitesEnseignementInMemoryTranslator, +) +from ...repository.in_memory.digit import DigitInMemoryRepository +from ...repository.in_memory.emplacement_document import ( + emplacement_document_in_memory_repository, +) +from ...repository.in_memory.titre_acces_selectionnable import ( + TitreAccesSelectionnableInMemoryRepositoryFactory, +) +from ...shared_kernel.email_destinataire.repository.in_memory import ( + EmailDestinataireInMemoryRepository, +) +from ..validation.repository.in_memory.demande import DemandeInMemoryRepository from .domain.service.in_memory.comptabilite import ComptabiliteInMemoryTranslator from .domain.service.in_memory.doctorat import DoctoratInMemoryTranslator from .domain.service.in_memory.historique import HistoriqueInMemory @@ -65,24 +112,14 @@ from .domain.service.in_memory.notification import NotificationInMemory from .domain.service.in_memory.pdf_generation import PDFGenerationInMemory from .domain.service.in_memory.promoteur import PromoteurInMemoryTranslator -from .domain.service.in_memory.question_specifique import QuestionSpecifiqueInMemoryTranslator +from .domain.service.in_memory.question_specifique import ( + QuestionSpecifiqueInMemoryTranslator, +) from .repository.doctorat import DoctoratRepository -from .repository.in_memory.groupe_de_supervision import GroupeDeSupervisionInMemoryRepository -from .repository.in_memory.proposition import PropositionInMemoryRepository -from ..validation.repository.in_memory.demande import DemandeInMemoryRepository -from ...domain.service.in_memory.calendrier_inscription import CalendrierInscriptionInMemory -from ...domain.service.in_memory.elements_confirmation import ElementsConfirmationInMemory -from ...domain.service.in_memory.historique import HistoriqueInMemory as HistoriqueGlobalInMemory -from ...domain.service.in_memory.maximum_propositions import MaximumPropositionsAutoriseesInMemory -from ...domain.service.in_memory.recuperer_documents_proposition import ( - EmplacementsDocumentsPropositionInMemoryTranslator, +from .repository.in_memory.groupe_de_supervision import ( + GroupeDeSupervisionInMemoryRepository, ) -from ...domain.service.in_memory.titres_acces import TitresAccesInMemory -from ...domain.service.in_memory.unites_enseignement_translator import UnitesEnseignementInMemoryTranslator -from ...repository.in_memory.digit import DigitInMemoryRepository -from ...repository.in_memory.emplacement_document import emplacement_document_in_memory_repository -from ...repository.in_memory.titre_acces_selectionnable import TitreAccesSelectionnableInMemoryRepositoryFactory -from ...shared_kernel.email_destinataire.repository.in_memory import EmailDestinataireInMemoryRepository +from .repository.in_memory.proposition import PropositionInMemoryRepository _proposition_repository = PropositionInMemoryRepository() _groupe_supervision_repository = GroupeDeSupervisionInMemoryRepository() diff --git a/infrastructure/admission/doctorat/preparation/repository/doctorat.py b/infrastructure/admission/doctorat/preparation/repository/doctorat.py index e7dffe0f9..f57032585 100644 --- a/infrastructure/admission/doctorat/preparation/repository/doctorat.py +++ b/infrastructure/admission/doctorat/preparation/repository/doctorat.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,14 +28,20 @@ from django.conf import settings from django.utils.translation import get_language -from admission.ddd.admission.doctorat.preparation.domain.model.doctorat import DoctoratIdentity -from admission.models import DoctorateAdmission -from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import DoctoratNonTrouveException +from admission.ddd.admission.doctorat.preparation.domain.model.doctorat import ( + DoctoratIdentity, +) +from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( + DoctoratNonTrouveException, +) from admission.ddd.admission.doctorat.preparation.dtos.doctorat import DoctoratDTO -from admission.ddd.admission.doctorat.preparation.repository.i_doctorat import IDoctoratRepository -from admission.infrastructure.admission.domain.service.bourse import BourseTranslator +from admission.ddd.admission.doctorat.preparation.repository.i_doctorat import ( + IDoctoratRepository, +) +from admission.models import DoctorateAdmission from admission.models.doctorate import PropositionProxy from base.models.student import Student +from infrastructure.reference.domain.service.bourse import BourseTranslator class DoctoratRepository(IDoctoratRepository): @@ -49,11 +55,7 @@ def verifier_existence(cls, entity_id: 'DoctoratIdentity') -> None: # pragma: n @classmethod def get_dto(cls, entity_id: 'DoctoratIdentity') -> 'DoctoratDTO': try: - doctorate: DoctorateAdmission = ( - PropositionProxy.objects - .for_dto() - .get(uuid=entity_id.uuid) - ) + doctorate: DoctorateAdmission = PropositionProxy.objects.for_dto().get(uuid=entity_id.uuid) except DoctorateAdmission.DoesNotExist: raise DoctoratNonTrouveException @@ -69,15 +71,19 @@ def get_dto(cls, entity_id: 'DoctoratIdentity') -> 'DoctoratDTO': annee_formation=doctorate.doctorate.academic_year.year, sigle_formation=doctorate.doctorate.acronym, noma_doctorant=student.registration_id if student else '', - intitule_formation=doctorate.doctorate.title - if get_language() == settings.LANGUAGE_CODE_FR - else doctorate.doctorate.title_english, + intitule_formation=( + doctorate.doctorate.title + if get_language() == settings.LANGUAGE_CODE_FR + else doctorate.doctorate.title_english + ), type_admission=doctorate.type, titre_these=doctorate.project_title, type_financement=doctorate.financing_type, autre_bourse_recherche=doctorate.other_international_scholarship, - bourse_recherche=BourseTranslator.build_dto(doctorate.international_scholarship) - if doctorate.international_scholarship - else None, + bourse_recherche=( + BourseTranslator.build_dto(doctorate.international_scholarship) + if doctorate.international_scholarship + else None + ), admission_acceptee_le=None, # TODO to add when the field will be added to the model ) diff --git a/infrastructure/admission/doctorat/preparation/repository/in_memory/doctorat.py b/infrastructure/admission/doctorat/preparation/repository/in_memory/doctorat.py index b99b5cd9b..d279bdd10 100644 --- a/infrastructure/admission/doctorat/preparation/repository/in_memory/doctorat.py +++ b/infrastructure/admission/doctorat/preparation/repository/in_memory/doctorat.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2023 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,12 +27,18 @@ from attr import dataclass -from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import DoctoratNonTrouveException +from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( + DoctoratNonTrouveException, +) from admission.ddd.admission.doctorat.preparation.dtos.doctorat import DoctoratDTO -from admission.ddd.admission.doctorat.preparation.repository.i_doctorat import IDoctoratRepository +from admission.ddd.admission.doctorat.preparation.repository.i_doctorat import ( + IDoctoratRepository, +) from admission.ddd.admission.doctorat.validation.domain.model.enums import ChoixGenre -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator from base.ddd.utils.in_memory_repository import InMemoryGenericRepository +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) @dataclass @@ -67,10 +73,7 @@ class DoctoratInMemoryRepository(InMemoryGenericRepository, IDoctoratRepository) @classmethod def _get(cls, entity_id: 'DoctoratIdentity') -> 'DoctoratDTO': - return next( - (dto for dto in cls.dtos if dto.uuid == entity_id.uuid), - None - ) + return next((dto for dto in cls.dtos if dto.uuid == entity_id.uuid), None) @classmethod def verifier_existence(cls, entity_id: 'DoctoratIdentity') -> None: @@ -89,9 +92,7 @@ def _create_dto(cls, uuid, matricule_doctorant, reference, sigle, bourse_recherc doctorant = next(d for d in cls.doctorants if d.matricule == matricule_doctorant) # pragma: no branch formation = next(f for f in cls.formations if f.sigle == sigle) # pragma: no branch bourse_recherche_dto = ( - BourseInMemoryTranslator.get_dto(uuid=str(bourse_recherche_uuid)) - if bourse_recherche_uuid - else None + BourseInMemoryTranslator.get_dto(uuid=str(bourse_recherche_uuid)) if bourse_recherche_uuid else None ) return DoctoratDTO( diff --git a/infrastructure/admission/doctorat/preparation/repository/in_memory/proposition.py b/infrastructure/admission/doctorat/preparation/repository/in_memory/proposition.py index a50a876d8..0408f1dfd 100644 --- a/infrastructure/admission/doctorat/preparation/repository/in_memory/proposition.py +++ b/infrastructure/admission/doctorat/preparation/repository/in_memory/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,13 +26,26 @@ from dataclasses import dataclass from typing import List, Optional -from admission.ddd.admission.doctorat.preparation.domain.model.enums import STATUTS_PROPOSITION_DOCTORALE_NON_SOUMISE -from admission.ddd.admission.doctorat.preparation.domain.model.proposition import Proposition, PropositionIdentity -from admission.ddd.admission.doctorat.preparation.domain.service.checklist import Checklist -from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import PropositionNonTrouveeException -from admission.ddd.admission.doctorat.preparation.dtos import PropositionDTO -from admission.ddd.admission.doctorat.preparation.dtos import PropositionGestionnaireDTO -from admission.ddd.admission.doctorat.preparation.repository.i_proposition import IPropositionRepository +from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( + STATUTS_PROPOSITION_DOCTORALE_NON_SOUMISE, +) +from admission.ddd.admission.doctorat.preparation.domain.model.proposition import ( + Proposition, + PropositionIdentity, +) +from admission.ddd.admission.doctorat.preparation.domain.service.checklist import ( + Checklist, +) +from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( + PropositionNonTrouveeException, +) +from admission.ddd.admission.doctorat.preparation.dtos import ( + PropositionDTO, + PropositionGestionnaireDTO, +) +from admission.ddd.admission.doctorat.preparation.repository.i_proposition import ( + IPropositionRepository, +) from admission.ddd.admission.doctorat.preparation.test.factory.proposition import ( PropositionAdmissionECGE3DPMinimaleFactory, PropositionAdmissionESP3DPMinimaleFactory, @@ -42,6 +55,7 @@ PropositionAdmissionSC3DPAvecPromoteurDejaApprouveFactory, PropositionAdmissionSC3DPAvecPromoteurRefuseEtMembreCADejaApprouveFactory, PropositionAdmissionSC3DPAvecPromoteursEtMembresCADejaApprouvesFactory, + PropositionAdmissionSC3DPConfirmeeFactory, PropositionAdmissionSC3DPMinimaleCotutelleAvecPromoteurExterneFactory, PropositionAdmissionSC3DPMinimaleCotutelleSansPromoteurExterneFactory, PropositionAdmissionSC3DPMinimaleFactory, @@ -53,9 +67,10 @@ PropositionAdmissionSC3DPSansPromoteurReferenceFactory, PropositionPreAdmissionSC3DPAvecPromoteursEtMembresCADejaApprouvesFactory, PropositionPreAdmissionSC3DPMinimaleFactory, - PropositionAdmissionSC3DPConfirmeeFactory, ) -from admission.ddd.admission.domain.service.i_unites_enseignement_translator import IUnitesEnseignementTranslator +from admission.ddd.admission.domain.service.i_unites_enseignement_translator import ( + IUnitesEnseignementTranslator, +) from admission.ddd.admission.enums.type_demande import TypeDemande from admission.ddd.admission.repository.i_proposition import formater_reference from admission.infrastructure.admission.doctorat.preparation.domain.service.in_memory.doctorat import ( @@ -64,11 +79,17 @@ from admission.infrastructure.admission.doctorat.preparation.repository.in_memory.groupe_de_supervision import ( GroupeDeSupervisionInMemoryRepository, ) -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator -from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ProfilCandidatInMemoryTranslator -from admission.infrastructure.admission.repository.in_memory.proposition import GlobalPropositionInMemoryRepository +from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ( + ProfilCandidatInMemoryTranslator, +) +from admission.infrastructure.admission.repository.in_memory.proposition import ( + GlobalPropositionInMemoryRepository, +) from admission.infrastructure.utils import dto_to_dict from base.ddd.utils.in_memory_repository import InMemoryGenericRepository +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) @dataclass @@ -295,19 +316,21 @@ def _load_dto(cls, proposition: 'Proposition'): documents_demandes=proposition.documents_demandes, documents_libres_fac_uclouvain=cls.documents_libres_fac_uclouvain.get(proposition.entity_id.uuid, []), documents_libres_sic_uclouvain=cls.documents_libres_sic_uclouvain.get(proposition.entity_id.uuid, []), - financabilite_regle_calcule=proposition.financabilite_regle_calcule.name - if proposition.financabilite_regle_calcule - else '', - financabilite_regle_calcule_situation=proposition.financabilite_regle_calcule_situation.name - if proposition.financabilite_regle_calcule_situation - else '', + financabilite_regle_calcule=( + proposition.financabilite_regle_calcule.name if proposition.financabilite_regle_calcule else '' + ), + financabilite_regle_calcule_situation=( + proposition.financabilite_regle_calcule_situation.name + if proposition.financabilite_regle_calcule_situation + else '' + ), financabilite_regle_calcule_le=proposition.financabilite_regle_calcule_le, financabilite_regle=proposition.financabilite_regle.name if proposition.financabilite_regle else '', financabilite_etabli_par=proposition.financabilite_etabli_par, financabilite_etabli_le=proposition.financabilite_etabli_le, - financabilite_derogation_statut=proposition.financabilite_derogation_statut.name - if proposition.financabilite_derogation_statut - else '', + financabilite_derogation_statut=( + proposition.financabilite_derogation_statut.name if proposition.financabilite_derogation_statut else '' + ), financabilite_derogation_premiere_notification_le=( proposition.financabilite_derogation_premiere_notification_le ), diff --git a/infrastructure/admission/doctorat/preparation/repository/proposition.py b/infrastructure/admission/doctorat/preparation/repository/proposition.py index aec57776b..3d50f68a1 100644 --- a/infrastructure/admission/doctorat/preparation/repository/proposition.py +++ b/infrastructure/admission/doctorat/preparation/repository/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,9 +35,9 @@ from django.utils.translation import get_language, pgettext from admission.auth.roles.candidate import Candidate -from admission.models import Accounting, DoctorateAdmission -from admission.models.doctorate import PropositionProxy -from admission.ddd.admission.doctorat.preparation.builder.proposition_identity_builder import PropositionIdentityBuilder +from admission.ddd.admission.doctorat.preparation.builder.proposition_identity_builder import ( + PropositionIdentityBuilder, +) from admission.ddd.admission.doctorat.preparation.domain.model._detail_projet import ( DetailProjet, ) @@ -62,11 +62,11 @@ ChoixTypeFinancement, ) from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( - DerogationFinancement, - BesoinDeDerogation, DROITS_INSCRIPTION_MONTANT_VALEURS, - DroitsInscriptionMontant, + BesoinDeDerogation, + DerogationFinancement, DispenseOuDroitsMajores, + DroitsInscriptionMontant, MobiliteNombreDeMois, ) from admission.ddd.admission.doctorat.preparation.domain.model.proposition import ( @@ -74,42 +74,48 @@ PropositionIdentity, ) from admission.ddd.admission.doctorat.preparation.domain.model.statut_checklist import ( - StatutsChecklistDoctorale, StatutChecklist, + StatutsChecklistDoctorale, ) from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( PropositionNonTrouveeException, ) from admission.ddd.admission.doctorat.preparation.dtos import ( + CotutelleDTO, DoctoratFormationDTO, PropositionDTO, - CotutelleDTO, + PropositionGestionnaireDTO, ) -from admission.ddd.admission.doctorat.preparation.dtos import PropositionGestionnaireDTO from admission.ddd.admission.doctorat.preparation.dtos.motif_refus import MotifRefusDTO from admission.ddd.admission.doctorat.preparation.repository.i_proposition import ( IPropositionRepository, ) from admission.ddd.admission.domain.model._profil_candidat import ProfilCandidat -from admission.ddd.admission.domain.model.bourse import BourseIdentity -from admission.ddd.admission.domain.model.complement_formation import ComplementFormationIdentity +from admission.ddd.admission.domain.model.complement_formation import ( + ComplementFormationIdentity, +) from admission.ddd.admission.domain.model.enums.equivalence import ( - TypeEquivalenceTitreAcces, - StatutEquivalenceTitreAcces, EtatEquivalenceTitreAcces, + StatutEquivalenceTitreAcces, + TypeEquivalenceTitreAcces, ) from admission.ddd.admission.domain.model.formation import FormationIdentity from admission.ddd.admission.domain.model.motif_refus import MotifRefusIdentity -from admission.ddd.admission.domain.service.i_unites_enseignement_translator import IUnitesEnseignementTranslator +from admission.ddd.admission.domain.service.i_unites_enseignement_translator import ( + IUnitesEnseignementTranslator, +) from admission.ddd.admission.dtos.campus import CampusDTO from admission.ddd.admission.dtos.profil_candidat import ProfilCandidatDTO from admission.ddd.admission.enums.type_demande import TypeDemande from admission.infrastructure.admission.doctorat.preparation.repository._comptabilite import ( get_accounting_from_admission, ) -from admission.infrastructure.admission.domain.service.bourse import BourseTranslator -from admission.infrastructure.admission.repository.proposition import GlobalPropositionRepository +from admission.infrastructure.admission.repository.proposition import ( + GlobalPropositionRepository, +) from admission.infrastructure.utils import dto_to_dict +from admission.models import Accounting, DoctorateAdmission +from admission.models.doctorate import PropositionProxy from base.models.academic_year import AcademicYear from base.models.education_group_year import EducationGroupYear from base.models.entity_version import EntityVersion @@ -117,9 +123,10 @@ from base.models.person import Person from ddd.logic.financabilite.domain.model.enums.etat import EtatFinancabilite from ddd.logic.financabilite.domain.model.enums.situation import SituationFinancabilite -from ddd.logic.learning_unit.dtos import LearningUnitSearchDTO -from ddd.logic.learning_unit.dtos import PartimSearchDTO +from ddd.logic.learning_unit.dtos import LearningUnitSearchDTO, PartimSearchDTO +from ddd.logic.reference.domain.model.bourse import BourseIdentity from epc.models.enums.condition_acces import ConditionAcces +from infrastructure.reference.domain.service.bourse import BourseTranslator from osis_common.ddd.interface import ApplicationService from reference.models.language import Language @@ -167,9 +174,11 @@ def _instantiate_admission(admission: 'DoctorateAdmission') -> 'Proposition': type=ChoixTypeFinancement[admission.financing_type] if admission.financing_type else None, type_contrat_travail=admission.financing_work_contract, eft=admission.financing_eft, - bourse_recherche=BourseIdentity(uuid=str(admission.international_scholarship_id)) - if admission.international_scholarship_id - else None, + bourse_recherche=( + BourseIdentity(uuid=str(admission.international_scholarship_id)) + if admission.international_scholarship_id + else None + ), autre_bourse_recherche=admission.other_international_scholarship, bourse_date_debut=admission.scholarship_start_date, bourse_date_fin=admission.scholarship_end_date, @@ -196,30 +205,34 @@ def _instantiate_admission(admission: 'DoctorateAdmission') -> 'Proposition': fiche_archive_signatures_envoyees=admission.archived_record_signatures_sent, auteur_derniere_modification=admission.last_update_author.global_id if admission.last_update_author else '', documents_demandes=admission.requested_documents, - profil_soumis_candidat=ProfilCandidat.from_dict(admission.submitted_profile) - if admission.submitted_profile - else None, + profil_soumis_candidat=( + ProfilCandidat.from_dict(admission.submitted_profile) if admission.submitted_profile else None + ), checklist_initiale=checklist_initiale and StatutsChecklistDoctorale.from_dict(checklist_initiale), checklist_actuelle=checklist_actuelle and StatutsChecklistDoctorale.from_dict(checklist_actuelle), motifs_refus=[MotifRefusIdentity(uuid=motif.uuid) for motif in admission.refusal_reasons.all()], autres_motifs_refus=admission.other_refusal_reasons, - financabilite_regle_calcule=EtatFinancabilite[admission.financability_computed_rule] - if admission.financability_computed_rule - else None, - financabilite_regle_calcule_situation=SituationFinancabilite[admission.financability_computed_rule_situation] - if admission.financability_computed_rule_situation - else None, + financabilite_regle_calcule=( + EtatFinancabilite[admission.financability_computed_rule] if admission.financability_computed_rule else None + ), + financabilite_regle_calcule_situation=( + SituationFinancabilite[admission.financability_computed_rule_situation] + if admission.financability_computed_rule_situation + else None + ), financabilite_regle_calcule_le=admission.financability_computed_rule_on, - financabilite_regle=SituationFinancabilite[admission.financability_rule] - if admission.financability_rule - else None, - financabilite_etabli_par=admission.financability_established_by.global_id - if admission.financability_established_by - else None, + financabilite_regle=( + SituationFinancabilite[admission.financability_rule] if admission.financability_rule else None + ), + financabilite_etabli_par=( + admission.financability_established_by.global_id if admission.financability_established_by else None + ), financabilite_etabli_le=admission.financability_established_on, - financabilite_derogation_statut=DerogationFinancement[admission.financability_dispensation_status] - if admission.financability_dispensation_status - else None, + financabilite_derogation_statut=( + DerogationFinancement[admission.financability_dispensation_status] + if admission.financability_dispensation_status + else None + ), financabilite_derogation_premiere_notification_le=admission.financability_dispensation_first_notification_on, financabilite_derogation_premiere_notification_par=( admission.financability_dispensation_first_notification_by.global_id @@ -248,30 +261,38 @@ def _instantiate_admission(admission: 'DoctorateAdmission') -> 'Proposition': condition_acces=ConditionAcces[admission.admission_requirement] if admission.admission_requirement else None, millesime_condition_acces=admission.admission_requirement_year and admission.admission_requirement_year.year, information_a_propos_de_la_restriction=admission.foreign_access_title_equivalency_restriction_about, - type_equivalence_titre_acces=TypeEquivalenceTitreAcces[admission.foreign_access_title_equivalency_type] - if admission.foreign_access_title_equivalency_type - else None, - statut_equivalence_titre_acces=StatutEquivalenceTitreAcces[admission.foreign_access_title_equivalency_status] - if admission.foreign_access_title_equivalency_status - else None, - etat_equivalence_titre_acces=EtatEquivalenceTitreAcces[admission.foreign_access_title_equivalency_state] - if admission.foreign_access_title_equivalency_state - else None, + type_equivalence_titre_acces=( + TypeEquivalenceTitreAcces[admission.foreign_access_title_equivalency_type] + if admission.foreign_access_title_equivalency_type + else None + ), + statut_equivalence_titre_acces=( + StatutEquivalenceTitreAcces[admission.foreign_access_title_equivalency_status] + if admission.foreign_access_title_equivalency_status + else None + ), + etat_equivalence_titre_acces=( + EtatEquivalenceTitreAcces[admission.foreign_access_title_equivalency_state] + if admission.foreign_access_title_equivalency_state + else None + ), date_prise_effet_equivalence_titre_acces=admission.foreign_access_title_equivalency_effective_date, - besoin_de_derogation=BesoinDeDerogation[admission.dispensation_needed] - if admission.dispensation_needed - else None, - droits_inscription_montant=DroitsInscriptionMontant[admission.tuition_fees_amount] - if admission.tuition_fees_amount - else None, + besoin_de_derogation=( + BesoinDeDerogation[admission.dispensation_needed] if admission.dispensation_needed else None + ), + droits_inscription_montant=( + DroitsInscriptionMontant[admission.tuition_fees_amount] if admission.tuition_fees_amount else None + ), droits_inscription_montant_autre=admission.tuition_fees_amount_other, - dispense_ou_droits_majores=DispenseOuDroitsMajores[admission.tuition_fees_dispensation] - if admission.tuition_fees_dispensation - else None, + dispense_ou_droits_majores=( + DispenseOuDroitsMajores[admission.tuition_fees_dispensation] + if admission.tuition_fees_dispensation + else None + ), est_mobilite=admission.is_mobility, - nombre_de_mois_de_mobilite=MobiliteNombreDeMois[admission.mobility_months_amount] - if admission.mobility_months_amount - else None, + nombre_de_mois_de_mobilite=( + MobiliteNombreDeMois[admission.mobility_months_amount] if admission.mobility_months_amount else None + ), doit_se_presenter_en_sic=admission.must_report_to_sic, communication_au_candidat=admission.communication_to_the_candidate, doit_fournir_visa_etudes=admission.must_provide_student_visa_d, @@ -437,19 +458,21 @@ def save(cls, entity: 'Proposition') -> None: and attrs.asdict(entity.checklist_actuelle, value_serializer=cls._serialize) or {}, }, - 'financability_computed_rule': entity.financabilite_regle_calcule.name - if entity.financabilite_regle_calcule - else '', - 'financability_computed_rule_situation': entity.financabilite_regle_calcule_situation.name - if entity.financabilite_regle_calcule_situation - else '', + 'financability_computed_rule': ( + entity.financabilite_regle_calcule.name if entity.financabilite_regle_calcule else '' + ), + 'financability_computed_rule_situation': ( + entity.financabilite_regle_calcule_situation.name + if entity.financabilite_regle_calcule_situation + else '' + ), 'financability_computed_rule_on': entity.financabilite_regle_calcule_le, 'financability_rule': entity.financabilite_regle.name if entity.financabilite_regle else '', 'financability_established_by': financabilite_etabli_par_person, 'financability_established_on': entity.financabilite_etabli_le, - 'financability_dispensation_status': entity.financabilite_derogation_statut.name - if entity.financabilite_derogation_statut - else '', + 'financability_dispensation_status': ( + entity.financabilite_derogation_statut.name if entity.financabilite_derogation_statut else '' + ), 'financability_dispensation_first_notification_on': ( entity.financabilite_derogation_premiere_notification_le ), @@ -474,29 +497,29 @@ def save(cls, entity: 'Proposition') -> None: 'join_program_fac_comment': entity.commentaire_programme_conjoint, 'admission_requirement': entity.condition_acces.name if entity.condition_acces else '', 'admission_requirement_year': academic_years.get(entity.millesime_condition_acces), - 'foreign_access_title_equivalency_type': entity.type_equivalence_titre_acces.name - if entity.type_equivalence_titre_acces - else '', + 'foreign_access_title_equivalency_type': ( + entity.type_equivalence_titre_acces.name if entity.type_equivalence_titre_acces else '' + ), 'foreign_access_title_equivalency_restriction_about': entity.information_a_propos_de_la_restriction, - 'foreign_access_title_equivalency_status': entity.statut_equivalence_titre_acces.name - if entity.statut_equivalence_titre_acces - else '', - 'foreign_access_title_equivalency_state': entity.etat_equivalence_titre_acces.name - if entity.etat_equivalence_titre_acces - else '', + 'foreign_access_title_equivalency_status': ( + entity.statut_equivalence_titre_acces.name if entity.statut_equivalence_titre_acces else '' + ), + 'foreign_access_title_equivalency_state': ( + entity.etat_equivalence_titre_acces.name if entity.etat_equivalence_titre_acces else '' + ), 'foreign_access_title_equivalency_effective_date': entity.date_prise_effet_equivalence_titre_acces, 'dispensation_needed': entity.besoin_de_derogation.name if entity.besoin_de_derogation else '', - 'tuition_fees_amount': entity.droits_inscription_montant.name - if entity.droits_inscription_montant - else '', + 'tuition_fees_amount': ( + entity.droits_inscription_montant.name if entity.droits_inscription_montant else '' + ), 'tuition_fees_amount_other': entity.droits_inscription_montant_autre, - 'tuition_fees_dispensation': entity.dispense_ou_droits_majores.name - if entity.dispense_ou_droits_majores - else '', + 'tuition_fees_dispensation': ( + entity.dispense_ou_droits_majores.name if entity.dispense_ou_droits_majores else '' + ), 'is_mobility': entity.est_mobilite, - 'mobility_months_amount': entity.nombre_de_mois_de_mobilite.name - if entity.nombre_de_mois_de_mobilite - else '', + 'mobility_months_amount': ( + entity.nombre_de_mois_de_mobilite.name if entity.nombre_de_mois_de_mobilite else '' + ), 'must_report_to_sic': entity.doit_se_presenter_en_sic, 'communication_to_the_candidate': entity.communication_au_candidat, 'must_provide_student_visa_d': entity.doit_fournir_visa_etudes, @@ -529,19 +552,25 @@ def _sauvegarder_comptabilite(cls, admission: DoctorateAdmission, entity: Propos admission=admission, defaults={ 'institute_absence_debts_certificate': entity.comptabilite.attestation_absence_dette_etablissement, - 'assimilation_situation': entity.comptabilite.type_situation_assimilation.name - if entity.comptabilite.type_situation_assimilation - else '', - 'assimilation_1_situation_type': entity.comptabilite.sous_type_situation_assimilation_1.name - if entity.comptabilite.sous_type_situation_assimilation_1 - else '', + 'assimilation_situation': ( + entity.comptabilite.type_situation_assimilation.name + if entity.comptabilite.type_situation_assimilation + else '' + ), + 'assimilation_1_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_1.name + if entity.comptabilite.sous_type_situation_assimilation_1 + else '' + ), 'long_term_resident_card': entity.comptabilite.carte_resident_longue_duree, 'cire_unlimited_stay_foreigner_card': entity.comptabilite.carte_cire_sejour_illimite_etranger, 'ue_family_member_residence_card': entity.comptabilite.carte_sejour_membre_ue, 'ue_family_member_permanent_residence_card': entity.comptabilite.carte_sejour_permanent_membre_ue, - 'assimilation_2_situation_type': entity.comptabilite.sous_type_situation_assimilation_2.name - if entity.comptabilite.sous_type_situation_assimilation_2 - else '', + 'assimilation_2_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_2.name + if entity.comptabilite.sous_type_situation_assimilation_2 + else '' + ), 'refugee_a_b_card': entity.comptabilite.carte_a_b_refugie, 'refugees_stateless_annex_25_26': entity.comptabilite.annexe_25_26_refugies_apatrides, 'registration_certificate': entity.comptabilite.attestation_immatriculation, @@ -550,20 +579,24 @@ def _sauvegarder_comptabilite(cls, admission: DoctorateAdmission, entity: Propos 'subsidiary_protection_decision': entity.comptabilite.decision_protection_subsidiaire, 'temporary_protection_decision': entity.comptabilite.decision_protection_temporaire, 'a_card': entity.comptabilite.carte_a, - 'assimilation_3_situation_type': entity.comptabilite.sous_type_situation_assimilation_3.name - if entity.comptabilite.sous_type_situation_assimilation_3 - else '', + 'assimilation_3_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_3.name + if entity.comptabilite.sous_type_situation_assimilation_3 + else '' + ), 'professional_3_month_residence_permit': entity.comptabilite.titre_sejour_3_mois_professionel, 'salary_slips': entity.comptabilite.fiches_remuneration, 'replacement_3_month_residence_permit': entity.comptabilite.titre_sejour_3_mois_remplacement, 'unemployment_benefit_pension_compensation_proof': unemployment_benefit_pension_proof, 'cpas_certificate': entity.comptabilite.attestation_cpas, - 'relationship': entity.comptabilite.relation_parente.name - if entity.comptabilite.relation_parente - else '', - 'assimilation_5_situation_type': entity.comptabilite.sous_type_situation_assimilation_5.name - if entity.comptabilite.sous_type_situation_assimilation_5 - else '', + 'relationship': ( + entity.comptabilite.relation_parente.name if entity.comptabilite.relation_parente else '' + ), + 'assimilation_5_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_5.name + if entity.comptabilite.sous_type_situation_assimilation_5 + else '' + ), 'household_composition_or_birth_certificate': entity.comptabilite.composition_menage_acte_naissance, 'tutorship_act': entity.comptabilite.acte_tutelle, 'household_composition_or_marriage_certificate': entity.comptabilite.composition_menage_acte_mariage, @@ -574,17 +607,19 @@ def _sauvegarder_comptabilite(cls, admission: DoctorateAdmission, entity: Propos 'parent_3_month_residence_permit': entity.comptabilite.titre_sejour_3_mois_parent, 'parent_salary_slips': entity.comptabilite.fiches_remuneration_parent, 'parent_cpas_certificate': entity.comptabilite.attestation_cpas_parent, - 'assimilation_6_situation_type': entity.comptabilite.sous_type_situation_assimilation_6.name - if entity.comptabilite.sous_type_situation_assimilation_6 - else '', + 'assimilation_6_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_6.name + if entity.comptabilite.sous_type_situation_assimilation_6 + else '' + ), 'cfwb_scholarship_decision': entity.comptabilite.decision_bourse_cfwb, 'scholarship_certificate': entity.comptabilite.attestation_boursier, 'ue_long_term_stay_identity_document': entity.comptabilite.titre_identite_sejour_longue_duree_ue, 'belgium_residence_permit': entity.comptabilite.titre_sejour_belgique, 'solidarity_student': entity.comptabilite.etudiant_solidaire, - 'account_number_type': entity.comptabilite.type_numero_compte.name - if entity.comptabilite.type_numero_compte - else '', + 'account_number_type': ( + entity.comptabilite.type_numero_compte.name if entity.comptabilite.type_numero_compte else '' + ), 'iban_account_number': entity.comptabilite.numero_compte_iban, 'valid_iban': entity.comptabilite.iban_valide, 'other_format_account_number': entity.comptabilite.numero_compte_autre_format, @@ -705,9 +740,11 @@ def _load_dto(cls, admission: DoctorateAdmission) -> 'PropositionDTO': type_financement=admission.financing_type, type_contrat_travail=admission.financing_work_contract, eft=admission.financing_eft, - bourse_recherche=BourseTranslator.build_dto(admission.international_scholarship) - if admission.international_scholarship - else None, + bourse_recherche=( + BourseTranslator.build_dto(admission.international_scholarship) + if admission.international_scholarship + else None + ), autre_bourse_recherche=admission.other_international_scholarship, bourse_date_debut=admission.scholarship_start_date, bourse_date_fin=admission.scholarship_end_date, @@ -756,9 +793,9 @@ def _load_dto(cls, admission: DoctorateAdmission) -> 'PropositionDTO': financabilite_regle_calcule_situation=admission.financability_computed_rule_situation, financabilite_regle_calcule_le=admission.financability_computed_rule_on, financabilite_regle=admission.financability_rule, - financabilite_etabli_par=admission.financability_established_by.global_id - if admission.financability_established_by - else '', + financabilite_etabli_par=( + admission.financability_established_by.global_id if admission.financability_established_by else '' + ), financabilite_etabli_le=admission.financability_established_on, financabilite_derogation_statut=admission.financability_dispensation_status, financabilite_derogation_premiere_notification_le=( @@ -818,29 +855,34 @@ def _load_dto_for_gestionnaire( noma_candidat=admission.student_registration_id or '', # from annotation photo_identite_candidat=admission.candidate.id_photo, adresse_email_candidat=admission.candidate.private_email, - cotutelle=CotutelleDTO( - cotutelle=admission.cotutelle, - motivation=admission.cotutelle_motivation, - institution_fwb=admission.cotutelle_institution_fwb, - institution=admission.cotutelle_institution, - demande_ouverture=admission.cotutelle_opening_request, - convention=admission.cotutelle_convention, - autres_documents=admission.cotutelle_other_documents, - autre_institution=bool( - admission.cotutelle_other_institution_name or admission.cotutelle_other_institution_address - ), - autre_institution_nom=admission.cotutelle_other_institution_name, - autre_institution_adresse=admission.cotutelle_other_institution_address, - ) - if admission.cotutelle - else None, - profil_soumis_candidat=ProfilCandidatDTO.from_dict( - dict_profile=admission.submitted_profile, - nom_pays_nationalite=admission.submitted_profile_country_of_citizenship_name or '', # from annotation - nom_pays_adresse=admission.submitted_profile_country_name or '', # from annotation - ) - if admission.submitted_profile - else None, + cotutelle=( + CotutelleDTO( + cotutelle=admission.cotutelle, + motivation=admission.cotutelle_motivation, + institution_fwb=admission.cotutelle_institution_fwb, + institution=admission.cotutelle_institution, + demande_ouverture=admission.cotutelle_opening_request, + convention=admission.cotutelle_convention, + autres_documents=admission.cotutelle_other_documents, + autre_institution=bool( + admission.cotutelle_other_institution_name or admission.cotutelle_other_institution_address + ), + autre_institution_nom=admission.cotutelle_other_institution_name, + autre_institution_adresse=admission.cotutelle_other_institution_address, + ) + if admission.cotutelle + else None + ), + profil_soumis_candidat=( + ProfilCandidatDTO.from_dict( + dict_profile=admission.submitted_profile, + nom_pays_nationalite=admission.submitted_profile_country_of_citizenship_name + or '', # from annotation + nom_pays_adresse=admission.submitted_profile_country_name or '', # from annotation + ) + if admission.submitted_profile + else None + ), motifs_refus=[ MotifRefusDTO(motif=mark_safe(reason.name), categorie=reason.category.name) for reason in admission.refusal_reasons.all() @@ -857,9 +899,9 @@ def _load_dto_for_gestionnaire( email_personne_contact_programme_annuel_annuel=admission.annual_program_contact_person_email, commentaire_programme_conjoint=admission.join_program_fac_comment, condition_acces=admission.admission_requirement, - millesime_condition_acces=admission.admission_requirement_year.year - if admission.admission_requirement_year - else None, + millesime_condition_acces=( + admission.admission_requirement_year.year if admission.admission_requirement_year else None + ), type_equivalence_titre_acces=admission.foreign_access_title_equivalency_type, information_a_propos_de_la_restriction=admission.foreign_access_title_equivalency_restriction_about, statut_equivalence_titre_acces=admission.foreign_access_title_equivalency_status, diff --git a/infrastructure/admission/domain/service/bourse.py b/infrastructure/admission/domain/service/bourse.py deleted file mode 100644 index d8191a236..000000000 --- a/infrastructure/admission/domain/service/bourse.py +++ /dev/null @@ -1,86 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -from typing import List, Dict - -from admission.models import Scholarship -from admission.ddd.admission.domain.builder.bourse_identity import BourseIdentityBuilder - -from admission.ddd.admission.domain.service.i_bourse import IBourseTranslator, BourseIdentity -from admission.ddd.admission.domain.validator.exceptions import BourseNonTrouveeException -from admission.ddd.admission.dtos.bourse import BourseDTO - - -class BourseTranslator(IBourseTranslator): - @classmethod - def get(cls, uuid: str) -> BourseIdentity: - if not cls.verifier_existence(uuid=uuid): - raise BourseNonTrouveeException - return BourseIdentityBuilder.build_from_uuid(uuid=uuid) - - @classmethod - def get_dto(cls, uuid: str) -> BourseDTO: - try: - scholarship = Scholarship.objects.get(pk=uuid) - return cls.build_dto(scholarship) - except Scholarship.DoesNotExist: - raise BourseNonTrouveeException - - @classmethod - def search(cls, uuids: List[str]) -> Dict[str, BourseIdentity]: - if uuids: - scholarships = { - str(scholarship.uuid): BourseIdentityBuilder.build_from_uuid(uuid=scholarship.uuid) - for scholarship in Scholarship.objects.filter(uuid__in=uuids) - } - if len(scholarships) != len(uuids): - raise BourseNonTrouveeException - return scholarships - return {} - - @classmethod - def search_dto(cls, uuids: List[str]) -> Dict[str, BourseDTO]: - if uuids: - scholarships = { - str(scholarship.uuid): cls.build_dto(scholarship) - for scholarship in Scholarship.objects.filter(uuid__in=uuids) - } - if len(scholarships) != len(uuids): - raise BourseNonTrouveeException - return scholarships - return {} - - @classmethod - def build_dto(cls, scholarship: Scholarship) -> BourseDTO: - return BourseDTO( - nom_court=scholarship.short_name, - nom_long=scholarship.long_name, - type=scholarship.type, - uuid=str(scholarship.uuid), - ) - - @classmethod - def verifier_existence(cls, uuid: str) -> bool: - return Scholarship.objects.filter(pk=uuid).exists() diff --git a/infrastructure/admission/domain/service/in_memory/bourse.py b/infrastructure/admission/domain/service/in_memory/bourse.py deleted file mode 100644 index c47efe9d0..000000000 --- a/infrastructure/admission/domain/service/in_memory/bourse.py +++ /dev/null @@ -1,137 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -from uuid import uuid4 -from dataclasses import dataclass -from typing import Optional, List, Dict - -from admission.ddd.admission.domain.builder.bourse_identity import BourseIdentityBuilder -from admission.ddd.admission.domain.service.i_bourse import IBourseTranslator, BourseIdentity -from admission.ddd.admission.domain.validator.exceptions import BourseNonTrouveeException -from admission.ddd.admission.dtos.bourse import BourseDTO -from admission.ddd.admission.enums.type_bourse import TypeBourse - - -@dataclass -class Bourse: - entity_id: BourseIdentity - type: TypeBourse - nom_court: str - nom_long: Optional[str] = '' - - -class BourseInMemoryTranslator(IBourseTranslator): - bourse_dd_1 = Bourse( - entity_id=BourseIdentity(uuid='a0e94dd5-3715-49a1-8953-8cc0f99372cb'), - type=TypeBourse.DOUBLE_TRIPLE_DIPLOMATION, - nom_court='AGRO DD UCLOUVAIN/GEM', - nom_long='AGRO DD UCLOUVAIN/GEM --', - ) - bourse_dd_2 = Bourse( - entity_id=BourseIdentity(uuid='b0e94dd5-3715-49a1-8953-8cc0f99372cb'), - type=TypeBourse.DOUBLE_TRIPLE_DIPLOMATION, - nom_court='CRIM DD UCL/LILLE', - nom_long='CRIM DD UCL/LILLE --', - ) - bourse_ifg_1 = Bourse( - entity_id=BourseIdentity(uuid='c0e94dd5-3715-49a1-8953-8cc0f99372cb'), - type=TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE, - nom_court='AFEPA', - nom_long='AFEPA --', - ) - bourse_ifg_2 = Bourse( - entity_id=BourseIdentity(uuid='d0e94dd5-3715-49a1-8953-8cc0f99372cb'), - type=TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE, - nom_court='WBI', - nom_long='WBI --', - ) - bourse_em_1 = Bourse( - entity_id=BourseIdentity(uuid='e0e94dd5-3715-49a1-8953-8cc0f99372cb'), - type=TypeBourse.ERASMUS_MUNDUS, - nom_court='EMDI', - nom_long='EMDI --', - ) - - ENTITIES = [ - bourse_dd_1, - bourse_dd_2, - bourse_ifg_1, - bourse_ifg_2, - bourse_em_1, - ] - - @classmethod - def get(cls, uuid: str) -> BourseIdentity: - if not cls.verifier_existence(uuid=uuid): - raise BourseNonTrouveeException - return BourseIdentityBuilder.build_from_uuid(uuid=uuid) - - @classmethod - def get_dto(cls, uuid: str) -> BourseDTO: - scholarship = next((entity for entity in cls.ENTITIES if entity.entity_id.uuid == uuid), None) - if scholarship: - return BourseDTO( - type=scholarship.type.name, - nom_court=scholarship.nom_court, - nom_long=scholarship.nom_long, - uuid=scholarship.entity_id.uuid, - ) - raise BourseNonTrouveeException - - @classmethod - def search(cls, uuids: List[str]) -> Dict[str, BourseIdentity]: - if uuids: - scholarships = { - scholarship.entity_id.uuid: BourseIdentityBuilder.build_from_uuid(uuid=scholarship.entity_id.uuid) - for scholarship in cls.ENTITIES - if scholarship.entity_id.uuid in uuids - } - if len(scholarships) != len(uuids): - raise BourseNonTrouveeException - return scholarships - return {} - - @classmethod - def search_dto(cls, uuids: List[str]) -> Dict[str, BourseDTO]: - if uuids: - scholarships = { - entity.entity_id.uuid: BourseDTO( - nom_court=entity.nom_court, - nom_long=entity.nom_long, - type=entity.type.name, - uuid=entity.entity_id.uuid, - ) - for entity in cls.ENTITIES - if entity.entity_id.uuid in uuids - } - if len(scholarships) != len(uuids): - raise BourseNonTrouveeException - return scholarships - - return {} - - @classmethod - def verifier_existence(cls, uuid: str) -> bool: - return any(scholarship for scholarship in cls.ENTITIES if scholarship.entity_id.uuid == uuid) diff --git a/infrastructure/admission/formation_generale/handlers.py b/infrastructure/admission/formation_generale/handlers.py index f34c20480..9ee72da92 100644 --- a/infrastructure/admission/formation_generale/handlers.py +++ b/infrastructure/admission/formation_generale/handlers.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,20 +28,22 @@ import waffle from admission.ddd.admission.commands import ( - RechercherCompteExistantCommand, - InitialiserPropositionFusionPersonneCommand, DefairePropositionFusionCommand, + GetStatutTicketPersonneQuery, + InitialiserPropositionFusionPersonneCommand, + RechercherCompteExistantCommand, RechercherParcoursAnterieurQuery, - SoumettreTicketPersonneCommand, RefuserPropositionFusionCommand, - GetStatutTicketPersonneQuery, - RetrieveListeTicketsEnAttenteQuery, RetrieveAndStoreStatutTicketPersonneFromDigitCommand, - ValiderTicketPersonneCommand, RetrieveListePropositionFusionEnErreurQuery, + RetrieveListeTicketsEnAttenteQuery, + SoumettreTicketPersonneCommand, + ValiderTicketPersonneCommand, ) from admission.ddd.admission.formation_generale.commands import * -from admission.ddd.admission.formation_generale.domain.model.enums import OngletsChecklist +from admission.ddd.admission.formation_generale.domain.model.enums import ( + OngletsChecklist, +) from admission.ddd.admission.formation_generale.use_case.read import * from admission.ddd.admission.formation_generale.use_case.read.recuperer_pdf_temporaire_decision_sic_service import ( recuperer_pdf_temporaire_decision_sic, @@ -59,7 +61,9 @@ from admission.ddd.admission.formation_generale.use_case.write.refuser_inscription_par_sic_service import ( refuser_inscription_par_sic, ) -from admission.ddd.admission.formation_generale.use_case.write.retyper_document_service import retyper_document +from admission.ddd.admission.formation_generale.use_case.write.retyper_document_service import ( + retyper_document, +) from admission.ddd.admission.formation_generale.use_case.write.specifier_besoin_de_derogation_service import ( specifier_besoin_de_derogation, ) @@ -78,22 +82,30 @@ from admission.ddd.admission.use_case.read import ( recuperer_questions_specifiques_proposition, ) -from admission.ddd.admission.use_case.read.rechercher_compte_existant import rechercher_compte_existant -from admission.ddd.admission.use_case.read.rechercher_parcours_anterieur import rechercher_parcours_anterieur +from admission.ddd.admission.use_case.read.rechercher_compte_existant import ( + rechercher_compte_existant, +) +from admission.ddd.admission.use_case.read.rechercher_parcours_anterieur import ( + rechercher_parcours_anterieur, +) from admission.ddd.admission.use_case.read.recuperer_propositions_en_erreur_service import ( recuperer_propositions_en_erreur, ) -from admission.ddd.admission.use_case.read.recuperer_statut_ticket_personne import recuperer_statut_ticket_personne -from admission.ddd.admission.use_case.read.recuperer_tickets_en_attente import recuperer_tickets_en_attente +from admission.ddd.admission.use_case.read.recuperer_statut_ticket_personne import ( + recuperer_statut_ticket_personne, +) +from admission.ddd.admission.use_case.read.recuperer_tickets_en_attente import ( + recuperer_tickets_en_attente, +) from admission.ddd.admission.use_case.write import ( - initialiser_emplacement_document_libre_non_reclamable, - initialiser_emplacement_document_libre_a_reclamer, - initialiser_emplacement_document_a_reclamer, annuler_reclamation_emplacement_document, + initialiser_emplacement_document_a_reclamer, + initialiser_emplacement_document_libre_a_reclamer, + initialiser_emplacement_document_libre_non_reclamable, modifier_reclamation_emplacement_document, - supprimer_emplacement_document, remplacer_emplacement_document, remplir_emplacement_document_par_gestionnaire, + supprimer_emplacement_document, ) from admission.ddd.admission.use_case.write.defaire_proposition_fusion_personne import ( defaire_proposition_fusion_personne, @@ -107,66 +119,112 @@ from admission.ddd.admission.use_case.write.refuser_proposition_fusion_personne import ( refuser_proposition_fusion_personne, ) -from admission.ddd.admission.use_case.write.soumettre_ticket_creation_personne import soumettre_ticket_creation_personne -from admission.ddd.admission.use_case.write.valider_ticket_creation_personne import valider_ticket_creation_personne +from admission.ddd.admission.use_case.write.soumettre_ticket_creation_personne import ( + soumettre_ticket_creation_personne, +) +from admission.ddd.admission.use_case.write.valider_ticket_creation_personne import ( + valider_ticket_creation_personne, +) from admission.infrastructure.admission.domain.service.annee_inscription_formation import ( AnneeInscriptionFormationTranslator, ) -from admission.infrastructure.admission.domain.service.bourse import BourseTranslator -from admission.infrastructure.admission.domain.service.calendrier_inscription import CalendrierInscription +from admission.infrastructure.admission.domain.service.calendrier_inscription import ( + CalendrierInscription, +) from admission.infrastructure.admission.domain.service.client_comptabilite_translator import ( ClientComptabiliteTranslator, ) from admission.infrastructure.admission.domain.service.digit import DigitService -from admission.infrastructure.admission.domain.service.elements_confirmation import ElementsConfirmation +from admission.infrastructure.admission.domain.service.elements_confirmation import ( + ElementsConfirmation, +) from admission.infrastructure.admission.domain.service.emplacements_documents_proposition import ( EmplacementsDocumentsPropositionTranslator, ) -from admission.infrastructure.admission.domain.service.historique import Historique as HistoriqueGlobal -from admission.infrastructure.admission.domain.service.maximum_propositions import MaximumPropositionsAutorisees +from admission.infrastructure.admission.domain.service.historique import ( + Historique as HistoriqueGlobal, +) +from admission.infrastructure.admission.domain.service.maximum_propositions import ( + MaximumPropositionsAutorisees, +) from admission.infrastructure.admission.domain.service.periode_soumission_ticket_digit import ( PeriodeSoumissionTicketDigitTranslator, ) -from admission.infrastructure.admission.domain.service.poste_diplomatique import PosteDiplomatiqueTranslator -from admission.infrastructure.admission.domain.service.profil_candidat import ProfilCandidatTranslator +from admission.infrastructure.admission.domain.service.poste_diplomatique import ( + PosteDiplomatiqueTranslator, +) +from admission.infrastructure.admission.domain.service.profil_candidat import ( + ProfilCandidatTranslator, +) from admission.infrastructure.admission.domain.service.titres_acces import TitresAcces from admission.infrastructure.admission.domain.service.unites_enseignement_translator import ( UnitesEnseignementTranslator, ) -from admission.infrastructure.admission.formation_generale.domain.service.comptabilite import ComptabiliteTranslator -from admission.infrastructure.admission.formation_generale.domain.service.formation import FormationGeneraleTranslator +from admission.infrastructure.admission.formation_generale.domain.service.comptabilite import ( + ComptabiliteTranslator, +) +from admission.infrastructure.admission.formation_generale.domain.service.formation import ( + FormationGeneraleTranslator, +) from admission.infrastructure.admission.formation_generale.domain.service.historique import ( Historique as HistoriqueFormationGenerale, ) -from admission.infrastructure.admission.formation_generale.domain.service.inscription_tardive import InscriptionTardive -from admission.infrastructure.admission.formation_generale.domain.service.notification import Notification +from admission.infrastructure.admission.formation_generale.domain.service.inscription_tardive import ( + InscriptionTardive, +) +from admission.infrastructure.admission.formation_generale.domain.service.notification import ( + Notification, +) from admission.infrastructure.admission.formation_generale.domain.service.paiement_frais_dossier import ( PaiementFraisDossier, ) -from admission.infrastructure.admission.formation_generale.domain.service.pdf_generation import PDFGeneration +from admission.infrastructure.admission.formation_generale.domain.service.pdf_generation import ( + PDFGeneration, +) from admission.infrastructure.admission.formation_generale.domain.service.question_specifique import ( QuestionSpecifiqueTranslator, ) -from admission.infrastructure.admission.formation_generale.domain.service.reference import ReferenceTranslator -from admission.infrastructure.admission.formation_generale.domain.service.taches_techniques import TachesTechniques +from admission.infrastructure.admission.formation_generale.domain.service.reference import ( + ReferenceTranslator, +) +from admission.infrastructure.admission.formation_generale.domain.service.taches_techniques import ( + TachesTechniques, +) from admission.infrastructure.admission.formation_generale.repository.emplacement_document import ( EmplacementDocumentRepository, ) -from admission.infrastructure.admission.formation_generale.repository.proposition import PropositionRepository +from admission.infrastructure.admission.formation_generale.repository.proposition import ( + PropositionRepository, +) from admission.infrastructure.admission.repository.digit import DigitRepository from admission.infrastructure.admission.repository.proposition_fusion_personne import ( PropositionPersonneFusionRepository, ) -from admission.infrastructure.admission.repository.titre_acces_selectionnable import TitreAccesSelectionnableRepository +from admission.infrastructure.admission.repository.titre_acces_selectionnable import ( + TitreAccesSelectionnableRepository, +) from admission.infrastructure.admission.shared_kernel.email_destinataire.repository.email_destinataire import ( EmailDestinataireRepository, ) -from infrastructure.financabilite.domain.service.financabilite import FinancabiliteFetcher -from infrastructure.shared_kernel.academic_year.repository.academic_year import AcademicYearRepository -from infrastructure.shared_kernel.campus.repository.uclouvain_campus import UclouvainCampusRepository -from infrastructure.shared_kernel.personne_connue_ucl.personne_connue_ucl import PersonneConnueUclTranslator -from infrastructure.shared_kernel.profil.domain.service.parcours_interne import ExperienceParcoursInterneTranslator -from infrastructure.shared_kernel.signaletique_etudiant.repository.compteur_noma import CompteurAnnuelPourNomaRepository +from infrastructure.financabilite.domain.service.financabilite import ( + FinancabiliteFetcher, +) +from infrastructure.reference.domain.service.bourse import BourseTranslator +from infrastructure.shared_kernel.academic_year.repository.academic_year import ( + AcademicYearRepository, +) +from infrastructure.shared_kernel.campus.repository.uclouvain_campus import ( + UclouvainCampusRepository, +) +from infrastructure.shared_kernel.personne_connue_ucl.personne_connue_ucl import ( + PersonneConnueUclTranslator, +) +from infrastructure.shared_kernel.profil.domain.service.parcours_interne import ( + ExperienceParcoursInterneTranslator, +) +from infrastructure.shared_kernel.signaletique_etudiant.repository.compteur_noma import ( + CompteurAnnuelPourNomaRepository, +) def _call_if_digit_switch_active(callable_fn): @@ -174,6 +232,7 @@ def _call_if_digit_switch_active(callable_fn): return callable_fn() else: import logging + from django.conf import settings logger = logging.getLogger(settings.DEFAULT_LOGGER) diff --git a/infrastructure/admission/formation_generale/handlers_in_memory.py b/infrastructure/admission/formation_generale/handlers_in_memory.py index 9244f42f6..4657c6719 100644 --- a/infrastructure/admission/formation_generale/handlers_in_memory.py +++ b/infrastructure/admission/formation_generale/handlers_in_memory.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,16 +26,18 @@ from mock.mock import Mock from admission.ddd.admission.commands import ( - SoumettreTicketPersonneCommand, - RechercherCompteExistantCommand, GetStatutTicketPersonneQuery, - RetrieveListeTicketsEnAttenteQuery, + RechercherCompteExistantCommand, RetrieveAndStoreStatutTicketPersonneFromDigitCommand, - ValiderTicketPersonneCommand, RetrieveListePropositionFusionEnErreurQuery, + RetrieveListeTicketsEnAttenteQuery, + SoumettreTicketPersonneCommand, + ValiderTicketPersonneCommand, ) from admission.ddd.admission.formation_generale.commands import * -from admission.ddd.admission.formation_generale.domain.model.enums import OngletsChecklist +from admission.ddd.admission.formation_generale.domain.model.enums import ( + OngletsChecklist, +) from admission.ddd.admission.formation_generale.test.factory.repository.paiement_frais_dossier import ( PaiementFraisDossierInMemoryRepositoryFactory, ) @@ -59,7 +61,9 @@ from admission.ddd.admission.formation_generale.use_case.write.refuser_inscription_par_sic_service import ( refuser_inscription_par_sic, ) -from admission.ddd.admission.formation_generale.use_case.write.retyper_document_service import retyper_document +from admission.ddd.admission.formation_generale.use_case.write.retyper_document_service import ( + retyper_document, +) from admission.ddd.admission.formation_generale.use_case.write.specifier_besoin_de_derogation_service import ( specifier_besoin_de_derogation, ) @@ -79,19 +83,18 @@ recuperer_questions_specifiques_proposition, ) from admission.ddd.admission.use_case.write import ( - initialiser_emplacement_document_libre_non_reclamable, - initialiser_emplacement_document_a_reclamer, annuler_reclamation_emplacement_document, + initialiser_emplacement_document_a_reclamer, + initialiser_emplacement_document_libre_a_reclamer, + initialiser_emplacement_document_libre_non_reclamable, modifier_reclamation_emplacement_document, - supprimer_emplacement_document, remplacer_emplacement_document, remplir_emplacement_document_par_gestionnaire, - initialiser_emplacement_document_libre_a_reclamer, + supprimer_emplacement_document, ) from admission.infrastructure.admission.domain.service.in_memory.annee_inscription_formation import ( AnneeInscriptionFormationInMemoryTranslator, ) -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator from admission.infrastructure.admission.domain.service.in_memory.calendrier_inscription import ( CalendrierInscriptionInMemory, ) @@ -107,11 +110,15 @@ from admission.infrastructure.admission.domain.service.in_memory.poste_diplomatique import ( PosteDiplomatiqueInMemoryFactory, ) -from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ProfilCandidatInMemoryTranslator +from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ( + ProfilCandidatInMemoryTranslator, +) from admission.infrastructure.admission.domain.service.in_memory.recuperer_documents_proposition import ( EmplacementsDocumentsPropositionInMemoryTranslator, ) -from admission.infrastructure.admission.domain.service.in_memory.titres_acces import TitresAccesInMemory +from admission.infrastructure.admission.domain.service.in_memory.titres_acces import ( + TitresAccesInMemory, +) from admission.infrastructure.admission.domain.service.in_memory.unites_enseignement_translator import ( UnitesEnseignementInMemoryTranslator, ) @@ -145,7 +152,9 @@ from admission.infrastructure.admission.formation_generale.repository.in_memory.proposition import ( PropositionInMemoryRepository, ) -from admission.infrastructure.admission.repository.in_memory.digit import DigitInMemoryRepository +from admission.infrastructure.admission.repository.in_memory.digit import ( + DigitInMemoryRepository, +) from admission.infrastructure.admission.repository.in_memory.emplacement_document import ( emplacement_document_in_memory_repository, ) @@ -155,9 +164,18 @@ from admission.infrastructure.admission.shared_kernel.email_destinataire.repository.in_memory.email_destinataire import ( EmailDestinataireInMemoryRepository, ) -from infrastructure.financabilite.domain.service.in_memory.financabilite import FinancabiliteInMemoryFetcher -from infrastructure.shared_kernel.academic_year.repository.in_memory.academic_year import AcademicYearInMemoryRepository -from infrastructure.shared_kernel.campus.repository.in_memory.campus import UclouvainCampusInMemoryRepository +from infrastructure.financabilite.domain.service.in_memory.financabilite import ( + FinancabiliteInMemoryFetcher, +) +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) +from infrastructure.shared_kernel.academic_year.repository.in_memory.academic_year import ( + AcademicYearInMemoryRepository, +) +from infrastructure.shared_kernel.campus.repository.in_memory.campus import ( + UclouvainCampusInMemoryRepository, +) from infrastructure.shared_kernel.personne_connue_ucl.in_memory.personne_connue_ucl import ( PersonneConnueUclInMemoryTranslator, ) diff --git a/infrastructure/admission/formation_generale/repository/in_memory/proposition.py b/infrastructure/admission/formation_generale/repository/in_memory/proposition.py index 51fde0e2a..2e42d720a 100644 --- a/infrastructure/admission/formation_generale/repository/in_memory/proposition.py +++ b/infrastructure/admission/formation_generale/repository/in_memory/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -29,44 +29,65 @@ import factory from admission.ddd import CODE_BACHELIER_VETERINAIRE -from admission.ddd.admission.domain.model.periode_soumission_ticket_digit import PeriodeSoumissionTicketDigit -from admission.ddd.admission.domain.service.i_unites_enseignement_translator import IUnitesEnseignementTranslator +from admission.ddd.admission.domain.model.periode_soumission_ticket_digit import ( + PeriodeSoumissionTicketDigit, +) +from admission.ddd.admission.domain.service.i_unites_enseignement_translator import ( + IUnitesEnseignementTranslator, +) from admission.ddd.admission.dtos.formation import BaseFormationDTO from admission.ddd.admission.dtos.profil_candidat import ProfilCandidatDTO from admission.ddd.admission.enums import TypeSituationAssimilation from admission.ddd.admission.enums.emplacement_document import ( - TypeEmplacementDocument, StatutEmplacementDocument, StatutReclamationEmplacementDocument, + TypeEmplacementDocument, ) from admission.ddd.admission.formation_generale.domain.model.enums import ( - ChoixStatutPropositionGenerale, DROITS_INSCRIPTION_MONTANT_VALEURS, + ChoixStatutPropositionGenerale, +) +from admission.ddd.admission.formation_generale.domain.model.proposition import ( + Proposition, + PropositionIdentity, +) +from admission.ddd.admission.formation_generale.domain.service.checklist import ( + Checklist, +) +from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( + PropositionNonTrouveeException, ) -from admission.ddd.admission.formation_generale.domain.model.proposition import Proposition, PropositionIdentity -from admission.ddd.admission.formation_generale.domain.service.checklist import Checklist -from admission.ddd.admission.formation_generale.domain.validator.exceptions import PropositionNonTrouveeException from admission.ddd.admission.formation_generale.dtos import PropositionDTO from admission.ddd.admission.formation_generale.dtos.motif_refus import MotifRefusDTO -from admission.ddd.admission.formation_generale.dtos.proposition import PropositionGestionnaireDTO -from admission.ddd.admission.formation_generale.repository.i_proposition import IPropositionRepository +from admission.ddd.admission.formation_generale.dtos.proposition import ( + PropositionGestionnaireDTO, +) +from admission.ddd.admission.formation_generale.repository.i_proposition import ( + IPropositionRepository, +) from admission.ddd.admission.formation_generale.test.factory.proposition import ( PropositionFactory, _PropositionIdentityFactory, ) from admission.ddd.admission.repository.i_proposition import formater_reference from admission.ddd.admission.test.factory.formation import FormationIdentityFactory -from admission.infrastructure.admission.domain.service.in_memory.bourse import BourseInMemoryTranslator from admission.infrastructure.admission.domain.service.in_memory.poste_diplomatique import ( PosteDiplomatiqueInMemoryTranslator, ) -from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ProfilCandidatInMemoryTranslator +from admission.infrastructure.admission.domain.service.in_memory.profil_candidat import ( + ProfilCandidatInMemoryTranslator, +) from admission.infrastructure.admission.formation_generale.domain.service.in_memory.formation import ( FormationGeneraleInMemoryTranslator, ) -from admission.infrastructure.admission.repository.in_memory.proposition import GlobalPropositionInMemoryRepository +from admission.infrastructure.admission.repository.in_memory.proposition import ( + GlobalPropositionInMemoryRepository, +) from admission.infrastructure.utils import dto_to_dict from base.ddd.utils.in_memory_repository import InMemoryGenericRepository +from infrastructure.reference.domain.service.in_memory.bourse import ( + BourseInMemoryTranslator, +) @dataclass @@ -269,15 +290,21 @@ def _load_dto(cls, proposition: Proposition) -> PropositionDTO: pot_calcule=proposition.pot_calcule and proposition.pot_calcule.name or '', date_fin_pot=None, soumise_le=None, - bourse_double_diplome=BourseInMemoryTranslator.get_dto(proposition.bourse_double_diplome_id.uuid) - if proposition.bourse_double_diplome_id - else None, - bourse_erasmus_mundus=BourseInMemoryTranslator.get_dto(proposition.bourse_erasmus_mundus_id.uuid) - if proposition.bourse_erasmus_mundus_id - else None, - bourse_internationale=BourseInMemoryTranslator.get_dto(proposition.bourse_internationale_id.uuid) - if proposition.bourse_internationale_id - else None, + bourse_double_diplome=( + BourseInMemoryTranslator.get_dto(proposition.bourse_double_diplome_id.uuid) + if proposition.bourse_double_diplome_id + else None + ), + bourse_erasmus_mundus=( + BourseInMemoryTranslator.get_dto(proposition.bourse_erasmus_mundus_id.uuid) + if proposition.bourse_erasmus_mundus_id + else None + ), + bourse_internationale=( + BourseInMemoryTranslator.get_dto(proposition.bourse_internationale_id.uuid) + if proposition.bourse_internationale_id + else None + ), reponses_questions_specifiques=proposition.reponses_questions_specifiques, equivalence_diplome=proposition.equivalence_diplome, curriculum=proposition.curriculum, @@ -300,19 +327,21 @@ def _load_dto(cls, proposition: Proposition) -> PropositionDTO: certificat_refus_sic=proposition.certificat_refus_sic, documents_additionnels=proposition.documents_additionnels, poste_diplomatique=poste_diplomatique, - financabilite_regle_calcule=proposition.financabilite_regle_calcule.name - if proposition.financabilite_regle_calcule - else '', - financabilite_regle_calcule_situation=proposition.financabilite_regle_calcule_situation.name - if proposition.financabilite_regle_calcule_situation - else '', + financabilite_regle_calcule=( + proposition.financabilite_regle_calcule.name if proposition.financabilite_regle_calcule else '' + ), + financabilite_regle_calcule_situation=( + proposition.financabilite_regle_calcule_situation.name + if proposition.financabilite_regle_calcule_situation + else '' + ), financabilite_regle_calcule_le=proposition.financabilite_regle_calcule_le, financabilite_regle=proposition.financabilite_regle.name if proposition.financabilite_regle else '', financabilite_etabli_par=proposition.financabilite_etabli_par, financabilite_etabli_le=proposition.financabilite_etabli_le, - financabilite_derogation_statut=proposition.financabilite_derogation_statut.name - if proposition.financabilite_derogation_statut - else '', + financabilite_derogation_statut=( + proposition.financabilite_derogation_statut.name if proposition.financabilite_derogation_statut else '' + ), financabilite_derogation_premiere_notification_le=( proposition.financabilite_derogation_premiere_notification_le ), @@ -374,23 +403,25 @@ def get_dto_for_gestionnaire( fraudeur_ares=False, non_financable=False, est_inscription_tardive=proposition.est_inscription_tardive, - profil_soumis_candidat=ProfilCandidatDTO( - prenom=proposition.profil_soumis_candidat.prenom, - nom=proposition.profil_soumis_candidat.nom, - genre=proposition.profil_soumis_candidat.genre, - nationalite=proposition.profil_soumis_candidat.nationalite, - nom_pays_nationalite=cls.countries.get(proposition.profil_soumis_candidat.nationalite, ''), - date_naissance=proposition.profil_soumis_candidat.date_naissance, - pays=proposition.profil_soumis_candidat.pays, - nom_pays=cls.countries.get(proposition.profil_soumis_candidat.pays, ''), - code_postal=proposition.profil_soumis_candidat.code_postal, - ville=proposition.profil_soumis_candidat.ville, - rue=proposition.profil_soumis_candidat.rue, - numero_rue=proposition.profil_soumis_candidat.numero_rue, - boite_postale=proposition.profil_soumis_candidat.boite_postale, - ) - if proposition.profil_soumis_candidat - else None, + profil_soumis_candidat=( + ProfilCandidatDTO( + prenom=proposition.profil_soumis_candidat.prenom, + nom=proposition.profil_soumis_candidat.nom, + genre=proposition.profil_soumis_candidat.genre, + nationalite=proposition.profil_soumis_candidat.nationalite, + nom_pays_nationalite=cls.countries.get(proposition.profil_soumis_candidat.nationalite, ''), + date_naissance=proposition.profil_soumis_candidat.date_naissance, + pays=proposition.profil_soumis_candidat.pays, + nom_pays=cls.countries.get(proposition.profil_soumis_candidat.pays, ''), + code_postal=proposition.profil_soumis_candidat.code_postal, + ville=proposition.profil_soumis_candidat.ville, + rue=proposition.profil_soumis_candidat.rue, + numero_rue=proposition.profil_soumis_candidat.numero_rue, + boite_postale=proposition.profil_soumis_candidat.boite_postale, + ) + if proposition.profil_soumis_candidat + else None + ), type_de_refus=proposition.type_de_refus, motifs_refus=[MotifRefusDTO(motif=motif.intitule, categorie=motif.categorie) for motif in motifs_refus], autre_formation_choisie_fac=formation_choisie_fac @@ -412,16 +443,16 @@ def get_dto_for_gestionnaire( commentaire_programme_conjoint=proposition.commentaire_programme_conjoint, condition_acces=proposition.condition_acces.name if proposition.condition_acces else '', millesime_condition_acces=proposition.millesime_condition_acces, - type_equivalence_titre_acces=proposition.type_equivalence_titre_acces - if proposition.type_equivalence_titre_acces - else '', + type_equivalence_titre_acces=( + proposition.type_equivalence_titre_acces if proposition.type_equivalence_titre_acces else '' + ), information_a_propos_de_la_restriction=proposition.information_a_propos_de_la_restriction, - statut_equivalence_titre_acces=proposition.statut_equivalence_titre_acces - if proposition.statut_equivalence_titre_acces - else '', - etat_equivalence_titre_acces=proposition.etat_equivalence_titre_acces - if proposition.etat_equivalence_titre_acces - else '', + statut_equivalence_titre_acces=( + proposition.statut_equivalence_titre_acces if proposition.statut_equivalence_titre_acces else '' + ), + etat_equivalence_titre_acces=( + proposition.etat_equivalence_titre_acces if proposition.etat_equivalence_titre_acces else '' + ), date_prise_effet_equivalence_titre_acces=proposition.date_prise_effet_equivalence_titre_acces, besoin_de_derogation=proposition.besoin_de_derogation, droits_inscription_montant=proposition.droits_inscription_montant, diff --git a/infrastructure/admission/formation_generale/repository/proposition.py b/infrastructure/admission/formation_generale/repository/proposition.py index 141e9809a..b13bc63b7 100644 --- a/infrastructure/admission/formation_generale/repository/proposition.py +++ b/infrastructure/admission/formation_generale/repository/proposition.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,68 +31,94 @@ import attrs from django.conf import settings from django.db import transaction -from django.db.models import OuterRef, Subquery, Prefetch, Case, IntegerField, When +from django.db.models import Case, IntegerField, OuterRef, Prefetch, Subquery, When from django.utils import timezone from django.utils.safestring import mark_safe from django.utils.translation import get_language, pgettext from osis_history.models import HistoryEntry from admission.auth.roles.candidate import Candidate -from admission.models import Accounting, GeneralEducationAdmissionProxy, Scholarship -from admission.models.checklist import RefusalReason, FreeAdditionalApprovalCondition -from admission.models.general_education import GeneralEducationAdmission -from admission.ddd.admission.domain.builder.formation_identity import FormationIdentityBuilder +from admission.ddd.admission.domain.builder.formation_identity import ( + FormationIdentityBuilder, +) from admission.ddd.admission.domain.model._profil_candidat import ProfilCandidat -from admission.ddd.admission.domain.model.bourse import BourseIdentity -from admission.ddd.admission.domain.model.complement_formation import ComplementFormationIdentity +from admission.ddd.admission.domain.model.complement_formation import ( + ComplementFormationIdentity, +) from admission.ddd.admission.domain.model.condition_complementaire_approbation import ( ConditionComplementaireApprobationIdentity, ConditionComplementaireLibreApprobation, ) from admission.ddd.admission.domain.model.enums.equivalence import ( - TypeEquivalenceTitreAcces, - StatutEquivalenceTitreAcces, EtatEquivalenceTitreAcces, + StatutEquivalenceTitreAcces, + TypeEquivalenceTitreAcces, ) from admission.ddd.admission.domain.model.motif_refus import MotifRefusIdentity -from admission.ddd.admission.domain.model.periode_soumission_ticket_digit import PeriodeSoumissionTicketDigit -from admission.ddd.admission.domain.model.poste_diplomatique import PosteDiplomatiqueIdentity -from admission.ddd.admission.domain.service.i_unites_enseignement_translator import IUnitesEnseignementTranslator -from admission.ddd.admission.dtos.formation import FormationDTO, BaseFormationDTO, CampusDTO +from admission.ddd.admission.domain.model.periode_soumission_ticket_digit import ( + PeriodeSoumissionTicketDigit, +) +from admission.ddd.admission.domain.model.poste_diplomatique import ( + PosteDiplomatiqueIdentity, +) +from admission.ddd.admission.domain.service.i_unites_enseignement_translator import ( + IUnitesEnseignementTranslator, +) +from admission.ddd.admission.dtos.formation import ( + BaseFormationDTO, + CampusDTO, + FormationDTO, +) from admission.ddd.admission.dtos.profil_candidat import ProfilCandidatDTO from admission.ddd.admission.enums import TypeSituationAssimilation -from admission.ddd.admission.enums.type_bourse import TypeBourse from admission.ddd.admission.enums.type_demande import TypeDemande from admission.ddd.admission.formation_generale.domain.builder.proposition_identity_builder import ( PropositionIdentityBuilder, ) from admission.ddd.admission.formation_generale.domain.model.enums import ( - ChoixStatutPropositionGenerale, DROITS_INSCRIPTION_MONTANT_VALEURS, - PoursuiteDeCycle, + STATUTS_PROPOSITION_GENERALE_SOUMISE, BesoinDeDerogation, + ChoixStatutPropositionGenerale, DerogationFinancement, - STATUTS_PROPOSITION_GENERALE_SOUMISE, + PoursuiteDeCycle, +) +from admission.ddd.admission.formation_generale.domain.model.proposition import ( + Proposition, + PropositionIdentity, ) -from admission.ddd.admission.formation_generale.domain.model.proposition import Proposition, PropositionIdentity from admission.ddd.admission.formation_generale.domain.model.statut_checklist import ( StatutChecklist, StatutsChecklistGenerale, ) from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( - PropositionNonTrouveeException, PremierePropositionSoumisesNonTrouveeException, + PropositionNonTrouveeException, ) from admission.ddd.admission.formation_generale.dtos import PropositionDTO -from admission.ddd.admission.formation_generale.dtos.condition_approbation import ConditionComplementaireApprobationDTO +from admission.ddd.admission.formation_generale.dtos.condition_approbation import ( + ConditionComplementaireApprobationDTO, +) from admission.ddd.admission.formation_generale.dtos.motif_refus import MotifRefusDTO -from admission.ddd.admission.formation_generale.dtos.proposition import PropositionGestionnaireDTO -from admission.ddd.admission.formation_generale.repository.i_proposition import IPropositionRepository -from admission.infrastructure.admission.domain.service.bourse import BourseTranslator -from admission.infrastructure.admission.domain.service.poste_diplomatique import PosteDiplomatiqueTranslator -from admission.infrastructure.admission.formation_generale.repository._comptabilite import get_accounting_from_admission -from admission.infrastructure.admission.repository.proposition import GlobalPropositionRepository +from admission.ddd.admission.formation_generale.dtos.proposition import ( + PropositionGestionnaireDTO, +) +from admission.ddd.admission.formation_generale.repository.i_proposition import ( + IPropositionRepository, +) +from admission.infrastructure.admission.domain.service.poste_diplomatique import ( + PosteDiplomatiqueTranslator, +) +from admission.infrastructure.admission.formation_generale.repository._comptabilite import ( + get_accounting_from_admission, +) +from admission.infrastructure.admission.repository.proposition import ( + GlobalPropositionRepository, +) from admission.infrastructure.utils import dto_to_dict +from admission.models import Accounting, GeneralEducationAdmissionProxy +from admission.models.checklist import FreeAdditionalApprovalCondition, RefusalReason +from admission.models.general_education import GeneralEducationAdmission from base.models.academic_year import AcademicYear from base.models.campus import Campus as CampusDb from base.models.education_group_year import EducationGroupYear @@ -101,10 +127,13 @@ from base.models.person import Person from ddd.logic.financabilite.domain.model.enums.etat import EtatFinancabilite from ddd.logic.financabilite.domain.model.enums.situation import SituationFinancabilite -from ddd.logic.learning_unit.dtos import LearningUnitSearchDTO -from ddd.logic.learning_unit.dtos import PartimSearchDTO +from ddd.logic.learning_unit.dtos import LearningUnitSearchDTO, PartimSearchDTO +from ddd.logic.reference.domain.model.bourse import BourseIdentity from epc.models.enums.condition_acces import ConditionAcces +from infrastructure.reference.domain.service.bourse import BourseTranslator from osis_common.ddd.interface import ApplicationService +from reference.models.enums.scholarship_type import ScholarshipType +from reference.models.scholarship import Scholarship class PropositionRepository(GlobalPropositionRepository, IPropositionRepository): @@ -280,9 +309,11 @@ def save(cls, entity: 'Proposition') -> None: 'reference': entity.reference, 'type_demande': entity.type_demande.name, 'submitted_at': entity.soumise_le, - 'double_degree_scholarship': scholarships.get(TypeBourse.DOUBLE_TRIPLE_DIPLOMATION.name), - 'international_scholarship': scholarships.get(TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name), - 'erasmus_mundus_scholarship': scholarships.get(TypeBourse.ERASMUS_MUNDUS.name), + 'double_degree_scholarship': scholarships.get(ScholarshipType.DOUBLE_TRIPLE_DIPLOMATION.name), + 'international_scholarship': scholarships.get( + ScholarshipType.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name + ), + 'erasmus_mundus_scholarship': scholarships.get(ScholarshipType.ERASMUS_MUNDUS.name), 'is_belgian_bachelor': entity.est_bachelier_belge, 'is_external_reorientation': entity.est_reorientation_inscription_externe, 'regular_registration_proof': entity.attestation_inscription_reguliere, @@ -306,19 +337,21 @@ def save(cls, entity: 'Proposition') -> None: or {}, }, 'cycle_pursuit': entity.poursuite_de_cycle.name, - 'financability_computed_rule': entity.financabilite_regle_calcule.name - if entity.financabilite_regle_calcule - else '', - 'financability_computed_rule_situation': entity.financabilite_regle_calcule_situation.name - if entity.financabilite_regle_calcule_situation - else '', + 'financability_computed_rule': ( + entity.financabilite_regle_calcule.name if entity.financabilite_regle_calcule else '' + ), + 'financability_computed_rule_situation': ( + entity.financabilite_regle_calcule_situation.name + if entity.financabilite_regle_calcule_situation + else '' + ), 'financability_computed_rule_on': entity.financabilite_regle_calcule_le, 'financability_rule': entity.financabilite_regle.name if entity.financabilite_regle else '', 'financability_established_by': financabilite_etabli_par_person, 'financability_established_on': entity.financabilite_etabli_le, - 'financability_dispensation_status': entity.financabilite_derogation_statut.name - if entity.financabilite_derogation_statut - else '', + 'financability_dispensation_status': ( + entity.financabilite_derogation_statut.name if entity.financabilite_derogation_statut else '' + ), 'financability_dispensation_first_notification_on': ( entity.financabilite_derogation_premiere_notification_le ), @@ -351,16 +384,16 @@ def save(cls, entity: 'Proposition') -> None: 'admission_requirement': entity.condition_acces.name if entity.condition_acces else '', 'admission_requirement_year': entity.millesime_condition_acces and academic_years[entity.millesime_condition_acces], - 'foreign_access_title_equivalency_type': entity.type_equivalence_titre_acces.name - if entity.type_equivalence_titre_acces - else '', + 'foreign_access_title_equivalency_type': ( + entity.type_equivalence_titre_acces.name if entity.type_equivalence_titre_acces else '' + ), 'foreign_access_title_equivalency_restriction_about': entity.information_a_propos_de_la_restriction, - 'foreign_access_title_equivalency_status': entity.statut_equivalence_titre_acces.name - if entity.statut_equivalence_titre_acces - else '', - 'foreign_access_title_equivalency_state': entity.etat_equivalence_titre_acces.name - if entity.etat_equivalence_titre_acces - else '', + 'foreign_access_title_equivalency_status': ( + entity.statut_equivalence_titre_acces.name if entity.statut_equivalence_titre_acces else '' + ), + 'foreign_access_title_equivalency_state': ( + entity.etat_equivalence_titre_acces.name if entity.etat_equivalence_titre_acces else '' + ), 'foreign_access_title_equivalency_effective_date': entity.date_prise_effet_equivalence_titre_acces, 'dispensation_needed': entity.besoin_de_derogation.name if entity.besoin_de_derogation else '', 'tuition_fees_amount': entity.droits_inscription_montant, @@ -412,19 +445,25 @@ def _sauvegarder_comptabilite(cls, admission, entity): 'french_community_study_allowance_application': fr_study_allowance_application, 'is_staff_child': entity.comptabilite.enfant_personnel, 'staff_child_certificate': entity.comptabilite.attestation_enfant_personnel, - 'assimilation_situation': entity.comptabilite.type_situation_assimilation.name - if entity.comptabilite.type_situation_assimilation - else '', - 'assimilation_1_situation_type': entity.comptabilite.sous_type_situation_assimilation_1.name - if entity.comptabilite.sous_type_situation_assimilation_1 - else '', + 'assimilation_situation': ( + entity.comptabilite.type_situation_assimilation.name + if entity.comptabilite.type_situation_assimilation + else '' + ), + 'assimilation_1_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_1.name + if entity.comptabilite.sous_type_situation_assimilation_1 + else '' + ), 'long_term_resident_card': entity.comptabilite.carte_resident_longue_duree, 'cire_unlimited_stay_foreigner_card': entity.comptabilite.carte_cire_sejour_illimite_etranger, 'ue_family_member_residence_card': entity.comptabilite.carte_sejour_membre_ue, 'ue_family_member_permanent_residence_card': entity.comptabilite.carte_sejour_permanent_membre_ue, - 'assimilation_2_situation_type': entity.comptabilite.sous_type_situation_assimilation_2.name - if entity.comptabilite.sous_type_situation_assimilation_2 - else '', + 'assimilation_2_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_2.name + if entity.comptabilite.sous_type_situation_assimilation_2 + else '' + ), 'refugee_a_b_card': entity.comptabilite.carte_a_b_refugie, 'refugees_stateless_annex_25_26': entity.comptabilite.annexe_25_26_refugies_apatrides, 'registration_certificate': entity.comptabilite.attestation_immatriculation, @@ -433,20 +472,24 @@ def _sauvegarder_comptabilite(cls, admission, entity): 'subsidiary_protection_decision': entity.comptabilite.decision_protection_subsidiaire, 'temporary_protection_decision': entity.comptabilite.decision_protection_temporaire, 'a_card': entity.comptabilite.carte_a, - 'assimilation_3_situation_type': entity.comptabilite.sous_type_situation_assimilation_3.name - if entity.comptabilite.sous_type_situation_assimilation_3 - else '', + 'assimilation_3_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_3.name + if entity.comptabilite.sous_type_situation_assimilation_3 + else '' + ), 'professional_3_month_residence_permit': entity.comptabilite.titre_sejour_3_mois_professionel, 'salary_slips': entity.comptabilite.fiches_remuneration, 'replacement_3_month_residence_permit': entity.comptabilite.titre_sejour_3_mois_remplacement, 'unemployment_benefit_pension_compensation_proof': unemployment_benefit_pension_proof, 'cpas_certificate': entity.comptabilite.attestation_cpas, - 'relationship': entity.comptabilite.relation_parente.name - if entity.comptabilite.relation_parente - else '', - 'assimilation_5_situation_type': entity.comptabilite.sous_type_situation_assimilation_5.name - if entity.comptabilite.sous_type_situation_assimilation_5 - else '', + 'relationship': ( + entity.comptabilite.relation_parente.name if entity.comptabilite.relation_parente else '' + ), + 'assimilation_5_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_5.name + if entity.comptabilite.sous_type_situation_assimilation_5 + else '' + ), 'household_composition_or_birth_certificate': entity.comptabilite.composition_menage_acte_naissance, 'tutorship_act': entity.comptabilite.acte_tutelle, 'household_composition_or_marriage_certificate': entity.comptabilite.composition_menage_acte_mariage, @@ -457,20 +500,22 @@ def _sauvegarder_comptabilite(cls, admission, entity): 'parent_3_month_residence_permit': entity.comptabilite.titre_sejour_3_mois_parent, 'parent_salary_slips': entity.comptabilite.fiches_remuneration_parent, 'parent_cpas_certificate': entity.comptabilite.attestation_cpas_parent, - 'assimilation_6_situation_type': entity.comptabilite.sous_type_situation_assimilation_6.name - if entity.comptabilite.sous_type_situation_assimilation_6 - else '', + 'assimilation_6_situation_type': ( + entity.comptabilite.sous_type_situation_assimilation_6.name + if entity.comptabilite.sous_type_situation_assimilation_6 + else '' + ), 'cfwb_scholarship_decision': entity.comptabilite.decision_bourse_cfwb, 'scholarship_certificate': entity.comptabilite.attestation_boursier, 'ue_long_term_stay_identity_document': entity.comptabilite.titre_identite_sejour_longue_duree_ue, 'belgium_residence_permit': entity.comptabilite.titre_sejour_belgique, - 'sport_affiliation': entity.comptabilite.affiliation_sport.name - if entity.comptabilite.affiliation_sport - else '', + 'sport_affiliation': ( + entity.comptabilite.affiliation_sport.name if entity.comptabilite.affiliation_sport else '' + ), 'solidarity_student': entity.comptabilite.etudiant_solidaire, - 'account_number_type': entity.comptabilite.type_numero_compte.name - if entity.comptabilite.type_numero_compte - else '', + 'account_number_type': ( + entity.comptabilite.type_numero_compte.name if entity.comptabilite.type_numero_compte else '' + ), 'iban_account_number': entity.comptabilite.numero_compte_iban, 'valid_iban': entity.comptabilite.iban_valide, 'other_format_account_number': entity.comptabilite.numero_compte_autre_format, @@ -507,15 +552,21 @@ def _load(cls, admission: 'GeneralEducationAdmission') -> 'Proposition': annee_calculee=admission.determined_academic_year and admission.determined_academic_year.year, pot_calcule=admission.determined_pool and AcademicCalendarTypes[admission.determined_pool], statut=ChoixStatutPropositionGenerale[admission.status], - bourse_internationale_id=BourseIdentity(uuid=str(admission.international_scholarship.uuid)) - if admission.international_scholarship - else None, - bourse_double_diplome_id=BourseIdentity(uuid=str(admission.double_degree_scholarship.uuid)) - if admission.double_degree_scholarship - else None, - bourse_erasmus_mundus_id=BourseIdentity(uuid=str(admission.erasmus_mundus_scholarship.uuid)) - if admission.erasmus_mundus_scholarship - else None, + bourse_internationale_id=( + BourseIdentity(uuid=str(admission.international_scholarship.uuid)) + if admission.international_scholarship + else None + ), + bourse_double_diplome_id=( + BourseIdentity(uuid=str(admission.double_degree_scholarship.uuid)) + if admission.double_degree_scholarship + else None + ), + bourse_erasmus_mundus_id=( + BourseIdentity(uuid=str(admission.erasmus_mundus_scholarship.uuid)) + if admission.erasmus_mundus_scholarship + else None + ), reponses_questions_specifiques=admission.specific_question_answers, est_bachelier_belge=admission.is_belgian_bachelor, est_reorientation_inscription_externe=admission.is_external_reorientation, @@ -529,34 +580,38 @@ def _load(cls, admission: 'GeneralEducationAdmission') -> 'Proposition': comptabilite=get_accounting_from_admission(admission=admission), elements_confirmation=admission.confirmation_elements, est_inscription_tardive=admission.late_enrollment, - profil_soumis_candidat=ProfilCandidat.from_dict(admission.submitted_profile) - if admission.submitted_profile - else None, + profil_soumis_candidat=( + ProfilCandidat.from_dict(admission.submitted_profile) if admission.submitted_profile else None + ), documents_demandes=admission.requested_documents, checklist_initiale=checklist_initiale and StatutsChecklistGenerale.from_dict(checklist_initiale), checklist_actuelle=checklist_actuelle and StatutsChecklistGenerale.from_dict(checklist_actuelle), type_de_refus=admission.refusal_type, motifs_refus=[MotifRefusIdentity(uuid=motif.uuid) for motif in admission.refusal_reasons.all()], autres_motifs_refus=admission.other_refusal_reasons, - financabilite_regle_calcule=EtatFinancabilite[admission.financability_computed_rule] - if admission.financability_computed_rule - else '', - financabilite_regle_calcule_situation=SituationFinancabilite[ - admission.financability_computed_rule_situation - ] - if admission.financability_computed_rule_situation - else '', + financabilite_regle_calcule=( + EtatFinancabilite[admission.financability_computed_rule] + if admission.financability_computed_rule + else '' + ), + financabilite_regle_calcule_situation=( + SituationFinancabilite[admission.financability_computed_rule_situation] + if admission.financability_computed_rule_situation + else '' + ), financabilite_regle_calcule_le=admission.financability_computed_rule_on, - financabilite_regle=SituationFinancabilite[admission.financability_rule] - if admission.financability_rule - else '', - financabilite_etabli_par=admission.financability_established_by.global_id - if admission.financability_established_by - else None, + financabilite_regle=( + SituationFinancabilite[admission.financability_rule] if admission.financability_rule else '' + ), + financabilite_etabli_par=( + admission.financability_established_by.global_id if admission.financability_established_by else None + ), financabilite_etabli_le=admission.financability_established_on, - financabilite_derogation_statut=DerogationFinancement[admission.financability_dispensation_status] - if admission.financability_dispensation_status - else '', + financabilite_derogation_statut=( + DerogationFinancement[admission.financability_dispensation_status] + if admission.financability_dispensation_status + else '' + ), financabilite_derogation_premiere_notification_le=( admission.financability_dispensation_first_notification_on ), @@ -578,12 +633,14 @@ def _load(cls, admission: 'GeneralEducationAdmission') -> 'Proposition': certificat_approbation_sic=admission.sic_approval_certificate, certificat_approbation_sic_annexe=admission.sic_annexe_approval_certificate, certificat_refus_sic=admission.sic_refusal_certificate, - autre_formation_choisie_fac_id=FormationIdentityBuilder.build( - sigle=admission.other_training_accepted_by_fac.acronym, - annee=admission.other_training_accepted_by_fac.academic_year.year, - ) - if admission.other_training_accepted_by_fac_id - else None, + autre_formation_choisie_fac_id=( + FormationIdentityBuilder.build( + sigle=admission.other_training_accepted_by_fac.acronym, + annee=admission.other_training_accepted_by_fac.academic_year.year, + ) + if admission.other_training_accepted_by_fac_id + else None + ), avec_conditions_complementaires=admission.with_additional_approval_conditions, conditions_complementaires_existantes=[ ConditionComplementaireApprobationIdentity(uuid=condition.uuid) @@ -608,30 +665,34 @@ def _load(cls, admission: 'GeneralEducationAdmission') -> 'Proposition': email_personne_contact_programme_annuel_annuel=admission.annual_program_contact_person_email, commentaire_programme_conjoint=admission.join_program_fac_comment, documents_additionnels=admission.additional_documents, - poste_diplomatique=PosteDiplomatiqueIdentity(code=admission.diplomatic_post.code) - if admission.diplomatic_post - else None, - condition_acces=ConditionAcces[admission.admission_requirement] - if admission.admission_requirement - else None, + poste_diplomatique=( + PosteDiplomatiqueIdentity(code=admission.diplomatic_post.code) if admission.diplomatic_post else None + ), + condition_acces=( + ConditionAcces[admission.admission_requirement] if admission.admission_requirement else None + ), millesime_condition_acces=admission.admission_requirement_year and admission.admission_requirement_year.year, information_a_propos_de_la_restriction=admission.foreign_access_title_equivalency_restriction_about, - type_equivalence_titre_acces=TypeEquivalenceTitreAcces[admission.foreign_access_title_equivalency_type] - if admission.foreign_access_title_equivalency_type - else None, - statut_equivalence_titre_acces=StatutEquivalenceTitreAcces[ - admission.foreign_access_title_equivalency_status - ] - if admission.foreign_access_title_equivalency_status - else None, - etat_equivalence_titre_acces=EtatEquivalenceTitreAcces[admission.foreign_access_title_equivalency_state] - if admission.foreign_access_title_equivalency_state - else None, + type_equivalence_titre_acces=( + TypeEquivalenceTitreAcces[admission.foreign_access_title_equivalency_type] + if admission.foreign_access_title_equivalency_type + else None + ), + statut_equivalence_titre_acces=( + StatutEquivalenceTitreAcces[admission.foreign_access_title_equivalency_status] + if admission.foreign_access_title_equivalency_status + else None + ), + etat_equivalence_titre_acces=( + EtatEquivalenceTitreAcces[admission.foreign_access_title_equivalency_state] + if admission.foreign_access_title_equivalency_state + else None + ), date_prise_effet_equivalence_titre_acces=admission.foreign_access_title_equivalency_effective_date, - besoin_de_derogation=BesoinDeDerogation[admission.dispensation_needed] - if admission.dispensation_needed - else '', + besoin_de_derogation=( + BesoinDeDerogation[admission.dispensation_needed] if admission.dispensation_needed else '' + ), droits_inscription_montant=admission.tuition_fees_amount, droits_inscription_montant_autre=admission.tuition_fees_amount_other, dispense_ou_droits_majores=admission.tuition_fees_dispensation, @@ -642,9 +703,11 @@ def _load(cls, admission: 'GeneralEducationAdmission') -> 'Proposition': nombre_de_mois_de_mobilite=admission.mobility_months_amount, doit_se_presenter_en_sic=admission.must_report_to_sic, communication_au_candidat=admission.communication_to_the_candidate, - poursuite_de_cycle=PoursuiteDeCycle[admission.cycle_pursuit] - if admission.cycle_pursuit - else PoursuiteDeCycle.TO_BE_DETERMINED, + poursuite_de_cycle=( + PoursuiteDeCycle[admission.cycle_pursuit] + if admission.cycle_pursuit + else PoursuiteDeCycle.TO_BE_DETERMINED + ), poursuite_de_cycle_a_specifier=admission.training.education_group_type.name == TrainingType.BACHELOR.name, auteur_derniere_modification=admission.last_update_author.global_id if admission.last_update_author else '', doit_fournir_visa_etudes=admission.must_provide_student_visa_d, @@ -680,47 +743,57 @@ def _load_dto(cls, admission: GeneralEducationAdmission) -> 'PropositionDTO': code=admission.training.partial_acronym, annee=admission.training.academic_year.year, date_debut=admission.training.academic_year.start_date, - intitule=admission.training.title - if get_language() == settings.LANGUAGE_CODE_FR - else admission.training.title_english, + intitule=( + admission.training.title + if get_language() == settings.LANGUAGE_CODE_FR + else admission.training.title_english + ), intitule_fr=admission.training.title, intitule_en=admission.training.title_english, - campus=CampusDTO( - uuid=campus.uuid, - nom=campus.name, - code_postal=campus.postal_code, - ville=campus.city, - pays_iso_code=campus.country.iso_code if campus.country else '', - nom_pays=campus.country.name if campus.country else '', - rue=campus.street, - numero_rue=campus.street_number, - boite_postale=campus.postal_box, - localisation=campus.location, - email_inscription_sic=campus.sic_enrollment_email, - ) - if campus - else None, + campus=( + CampusDTO( + uuid=campus.uuid, + nom=campus.name, + code_postal=campus.postal_code, + ville=campus.city, + pays_iso_code=campus.country.iso_code if campus.country else '', + nom_pays=campus.country.name if campus.country else '', + rue=campus.street, + numero_rue=campus.street_number, + boite_postale=campus.postal_box, + localisation=campus.location, + email_inscription_sic=campus.sic_enrollment_email, + ) + if campus + else None + ), type=admission.training.education_group_type.name, code_domaine=admission.training.main_domain.code if admission.training.main_domain else '', - campus_inscription=CampusDTO( - uuid=admission.training.enrollment_campus.uuid, - nom=admission.training.enrollment_campus.name, - code_postal=admission.training.enrollment_campus.postal_code, - ville=admission.training.enrollment_campus.city, - pays_iso_code=admission.training.enrollment_campus.country.iso_code - if admission.training.enrollment_campus.country - else '', - nom_pays=admission.training.enrollment_campus.country.name - if admission.training.enrollment_campus.country - else '', - rue=admission.training.enrollment_campus.street, - numero_rue=admission.training.enrollment_campus.street_number, - boite_postale=admission.training.enrollment_campus.postal_box, - localisation=admission.training.enrollment_campus.location, - email_inscription_sic=admission.training.enrollment_campus.sic_enrollment_email, - ) - if admission.training.enrollment_campus - else None, + campus_inscription=( + CampusDTO( + uuid=admission.training.enrollment_campus.uuid, + nom=admission.training.enrollment_campus.name, + code_postal=admission.training.enrollment_campus.postal_code, + ville=admission.training.enrollment_campus.city, + pays_iso_code=( + admission.training.enrollment_campus.country.iso_code + if admission.training.enrollment_campus.country + else '' + ), + nom_pays=( + admission.training.enrollment_campus.country.name + if admission.training.enrollment_campus.country + else '' + ), + rue=admission.training.enrollment_campus.street, + numero_rue=admission.training.enrollment_campus.street_number, + boite_postale=admission.training.enrollment_campus.postal_box, + localisation=admission.training.enrollment_campus.location, + email_inscription_sic=admission.training.enrollment_campus.sic_enrollment_email, + ) + if admission.training.enrollment_campus + else None + ), sigle_entite_gestion=admission.training_management_faculty or admission.sigle_entite_gestion, # from annotation credits=admission.training.credits, @@ -728,15 +801,21 @@ def _load_dto(cls, admission: GeneralEducationAdmission) -> 'PropositionDTO': matricule_candidat=admission.candidate.global_id, prenom_candidat=admission.candidate.first_name, nom_candidat=admission.candidate.last_name, - bourse_double_diplome=BourseTranslator.build_dto(admission.double_degree_scholarship) - if admission.double_degree_scholarship - else None, - bourse_internationale=BourseTranslator.build_dto(admission.international_scholarship) - if admission.international_scholarship - else None, - bourse_erasmus_mundus=BourseTranslator.build_dto(admission.erasmus_mundus_scholarship) - if admission.erasmus_mundus_scholarship - else None, + bourse_double_diplome=( + BourseTranslator.build_dto(admission.double_degree_scholarship) + if admission.double_degree_scholarship + else None + ), + bourse_internationale=( + BourseTranslator.build_dto(admission.international_scholarship) + if admission.international_scholarship + else None + ), + bourse_erasmus_mundus=( + BourseTranslator.build_dto(admission.erasmus_mundus_scholarship) + if admission.erasmus_mundus_scholarship + else None + ), reponses_questions_specifiques=admission.specific_question_answers, curriculum=admission.curriculum, equivalence_diplome=admission.diploma_equivalence, @@ -756,9 +835,9 @@ def _load_dto(cls, admission: GeneralEducationAdmission) -> 'PropositionDTO': financabilite_regle_calcule_situation=admission.financability_computed_rule_situation, financabilite_regle_calcule_le=admission.financability_computed_rule_on, financabilite_regle=admission.financability_rule, - financabilite_etabli_par=admission.financability_established_by.global_id - if admission.financability_established_by - else None, + financabilite_etabli_par=( + admission.financability_established_by.global_id if admission.financability_established_by else None + ), financabilite_etabli_le=admission.financability_established_on, financabilite_derogation_statut=admission.financability_dispensation_status, financabilite_derogation_premiere_notification_le=( @@ -783,9 +862,9 @@ def _load_dto(cls, admission: GeneralEducationAdmission) -> 'PropositionDTO': certificat_approbation_sic_annexe=admission.sic_annexe_approval_certificate, certificat_refus_sic=admission.sic_refusal_certificate, documents_additionnels=admission.additional_documents, - poste_diplomatique=PosteDiplomatiqueTranslator.build_dto(admission.diplomatic_post) - if admission.diplomatic_post - else None, + poste_diplomatique=( + PosteDiplomatiqueTranslator.build_dto(admission.diplomatic_post) if admission.diplomatic_post else None + ), doit_fournir_visa_etudes=admission.must_provide_student_visa_d, visa_etudes_d=admission.student_visa_d, certificat_autorisation_signe=admission.signed_enrollment_authorization, @@ -810,23 +889,27 @@ def _load_dto_for_gestionnaire( photo_identite_candidat=admission.candidate.id_photo, adresse_email_candidat=admission.candidate.private_email, langue_contact_candidat=admission.candidate.language, - nationalite_candidat=getattr( - admission.candidate.country_of_citizenship, - 'name' if is_french_language else 'name_en', - ) - if admission.candidate.country_of_citizenship - else '', - nationalite_candidat_fr=admission.candidate.country_of_citizenship.name - if admission.candidate.country_of_citizenship - else '', - nationalite_candidat_en=admission.candidate.country_of_citizenship.name_en - if admission.candidate.country_of_citizenship - else '', + nationalite_candidat=( + getattr( + admission.candidate.country_of_citizenship, + 'name' if is_french_language else 'name_en', + ) + if admission.candidate.country_of_citizenship + else '' + ), + nationalite_candidat_fr=( + admission.candidate.country_of_citizenship.name if admission.candidate.country_of_citizenship else '' + ), + nationalite_candidat_en=( + admission.candidate.country_of_citizenship.name_en if admission.candidate.country_of_citizenship else '' + ), nationalite_ue_candidat=admission.candidate.country_of_citizenship and admission.candidate.country_of_citizenship.european_union, - nationalite_candidat_code_iso=admission.candidate.country_of_citizenship.iso_code - if admission.candidate.country_of_citizenship - else '', + nationalite_candidat_code_iso=( + admission.candidate.country_of_citizenship.iso_code + if admission.candidate.country_of_citizenship + else '' + ), poursuite_de_cycle_a_specifier=poursuite_de_cycle_a_specifier, poursuite_de_cycle=admission.cycle_pursuit if poursuite_de_cycle_a_specifier else '', candidat_a_plusieurs_demandes=admission.has_several_admissions_in_progress, # from annotation @@ -837,13 +920,15 @@ def _load_dto_for_gestionnaire( fraudeur_ares=False, # TODO non_financable=False, # TODO, est_inscription_tardive=admission.late_enrollment, - profil_soumis_candidat=ProfilCandidatDTO.from_dict( - dict_profile=admission.submitted_profile, - nom_pays_nationalite=admission.submitted_profile_country_of_citizenship_name, # from annotation - nom_pays_adresse=admission.submitted_profile_country_name, # from annotation - ) - if admission.submitted_profile - else None, + profil_soumis_candidat=( + ProfilCandidatDTO.from_dict( + dict_profile=admission.submitted_profile, + nom_pays_nationalite=admission.submitted_profile_country_of_citizenship_name, # from annotation + nom_pays_adresse=admission.submitted_profile_country_name, # from annotation + ) + if admission.submitted_profile + else None + ), type_de_refus=admission.refusal_type, motifs_refus=[ MotifRefusDTO(motif=mark_safe(reason.name), categorie=reason.category.name) @@ -853,17 +938,21 @@ def _load_dto_for_gestionnaire( MotifRefusDTO(motif=reason, categorie=pgettext('admission', 'Other reasons')) for reason in admission.other_refusal_reasons ], - autre_formation_choisie_fac=BaseFormationDTO( - sigle=admission.other_training_accepted_by_fac.acronym, - annee=admission.other_training_accepted_by_fac.academic_year.year, - uuid=admission.other_training_accepted_by_fac.uuid, - intitule=admission.other_training_accepted_by_fac.title - if get_language() == settings.LANGUAGE_CODE_FR - else admission.other_training_accepted_by_fac.title_english, - lieu_enseignement=admission.other_training_accepted_by_fac_teaching_campus, # From annotation - ) - if admission.other_training_accepted_by_fac_id - else None, + autre_formation_choisie_fac=( + BaseFormationDTO( + sigle=admission.other_training_accepted_by_fac.acronym, + annee=admission.other_training_accepted_by_fac.academic_year.year, + uuid=admission.other_training_accepted_by_fac.uuid, + intitule=( + admission.other_training_accepted_by_fac.title + if get_language() == settings.LANGUAGE_CODE_FR + else admission.other_training_accepted_by_fac.title_english + ), + lieu_enseignement=admission.other_training_accepted_by_fac_teaching_campus, # From annotation + ) + if admission.other_training_accepted_by_fac_id + else None + ), avec_conditions_complementaires=admission.with_additional_approval_conditions, conditions_complementaires=[ ConditionComplementaireApprobationDTO( @@ -892,9 +981,9 @@ def _load_dto_for_gestionnaire( email_personne_contact_programme_annuel_annuel=admission.annual_program_contact_person_email, commentaire_programme_conjoint=admission.join_program_fac_comment, condition_acces=admission.admission_requirement, - millesime_condition_acces=admission.admission_requirement_year.year - if admission.admission_requirement_year - else None, + millesime_condition_acces=( + admission.admission_requirement_year.year if admission.admission_requirement_year else None + ), type_equivalence_titre_acces=admission.foreign_access_title_equivalency_type, information_a_propos_de_la_restriction=admission.foreign_access_title_equivalency_restriction_about, statut_equivalence_titre_acces=admission.foreign_access_title_equivalency_status, diff --git a/locale/en/LC_MESSAGES/django.po b/locale/en/LC_MESSAGES/django.po index 9c3c2cf47..fabff69af 100644 --- a/locale/en/LC_MESSAGES/django.po +++ b/locale/en/LC_MESSAGES/django.po @@ -1215,9 +1215,6 @@ msgid "" "number" msgstr "" -msgid "Canvas" -msgstr "" - msgid "Carbon-copy the CA members" msgstr "" @@ -1494,9 +1491,6 @@ msgstr "" msgid "Confirmation exam date" msgstr "" -msgid "Confirmation success attestation" -msgstr "" - msgid "Contact" msgstr "" @@ -2008,9 +2002,6 @@ msgctxt "X" msgid "Director of the Saint-Louis Bruxelles Enrolment Office" msgstr "" -msgid "Disabled" -msgstr "" - msgid "Discard fusion" msgstr "" @@ -2229,9 +2220,6 @@ msgid "" "leading to two separate diplomas awarded by each signatory university." msgstr "" -msgid "Dual or triple degree" -msgstr "" - msgid "Duplicate experience" msgstr "" @@ -2440,9 +2428,6 @@ msgstr "" msgid "Employer" msgstr "" -msgid "Enabled" -msgstr "" - msgctxt "admission" msgid "End" msgstr "" @@ -3596,12 +3581,6 @@ msgstr "" msgid "Internal label" msgstr "" -msgid "International for doctorate" -msgstr "" - -msgid "International for general education" -msgstr "" - msgid "International scholarship" msgstr "" @@ -3838,9 +3817,6 @@ msgstr "" msgid "Long label in french" msgstr "" -msgid "Long name" -msgstr "" - msgid "Long-term resident card" msgstr "" @@ -4327,9 +4303,6 @@ msgstr "" msgid "No pool was found to match." msgstr "" -msgid "No scholarship found." -msgstr "" - msgid "No specific profile" msgstr "" @@ -5475,10 +5448,6 @@ msgstr "" msgid "Scholarship" msgstr "" -msgctxt "admission model" -msgid "Scholarship" -msgstr "" - msgctxt "doctorate-header-list" msgid "Scholarship" msgstr "" @@ -5641,9 +5610,6 @@ msgstr "" msgid "Short label in french" msgstr "" -msgid "Short name" -msgstr "" - msgid "Show details" msgstr "" diff --git a/locale/fr_BE/LC_MESSAGES/django.po b/locale/fr_BE/LC_MESSAGES/django.po index ed209dfa6..fe99b8dba 100644 --- a/locale/fr_BE/LC_MESSAGES/django.po +++ b/locale/fr_BE/LC_MESSAGES/django.po @@ -1330,9 +1330,6 @@ msgstr "" "Vous ne pouvez pas rejeter la fusion car au moins une personne connue a le " "même numéro de registre national" -msgid "Canvas" -msgstr "Canvas" - msgid "Carbon-copy the CA members" msgstr "Mettre en copie les membres du groupe de supervision" @@ -1626,9 +1623,6 @@ msgstr "Épreuve de confirmation" msgid "Confirmation exam date" msgstr "Date de l'épreuve de confirmation" -msgid "Confirmation success attestation" -msgstr "Attestation de réussite de l'épreuve de confirmation" - msgid "Contact" msgstr "Contact" @@ -2200,9 +2194,6 @@ msgctxt "X" msgid "Director of the Saint-Louis Bruxelles Enrolment Office" msgstr "Directeur·trice du Service des inscriptions Saint-Louis Bruxelles" -msgid "Disabled" -msgstr "Désactivé" - msgid "Discard fusion" msgstr "Rejeter la fusion" @@ -2439,9 +2430,6 @@ msgstr "" "plusieurs universités, qui débouchera sur l'obtention de deux diplômes " "distincts fournis par chaque université signataire." -msgid "Dual or triple degree" -msgstr "Double ou triple diplomation" - msgid "Duplicate experience" msgstr "Dupliquer l'expérience" @@ -2690,9 +2678,6 @@ msgstr "Contact en cas d'urgence (numéro de téléphone)" msgid "Employer" msgstr "Employeur" -msgid "Enabled" -msgstr "Activé" - msgctxt "admission" msgid "End" msgstr "Fin" @@ -4038,12 +4023,6 @@ msgstr "Les expériences internes à choisir comme des titres d'accès" msgid "Internal label" msgstr "Label interne" -msgid "International for doctorate" -msgstr "Internationale pour les doctorats" - -msgid "International for general education" -msgstr "Internationale pour les formation générales" - msgid "International scholarship" msgstr "Bourse internationale" @@ -4291,9 +4270,6 @@ msgstr "Libellé long en anglais" msgid "Long label in french" msgstr "Libellé long en français" -msgid "Long name" -msgstr "Nom long" - msgid "Long-term resident card" msgstr "Carte de résident longue durée" @@ -4841,9 +4817,6 @@ msgstr "Aucun invité" msgid "No pool was found to match." msgstr "Aucun pot ne correspond." -msgid "No scholarship found." -msgstr "Bourse non trouvée." - msgid "No specific profile" msgstr "Pas de profil particulier" @@ -6061,10 +6034,6 @@ msgstr "Enregistrer la proposition de fusion" msgid "Scholarship" msgstr "Boursier" -msgctxt "admission model" -msgid "Scholarship" -msgstr "Bourse" - msgctxt "doctorate-header-list" msgid "Scholarship" msgstr "Bourse" @@ -6229,9 +6198,6 @@ msgstr "Libellé court en anglais" msgid "Short label in french" msgstr "Libellé court en français" -msgid "Short name" -msgstr "Nom court" - msgid "Show details" msgstr "Voir le détail" @@ -8509,23 +8475,3 @@ msgstr "" #, python-brace-format msgid "{items} types out of {total}" msgstr "{items} types sur {total}" - -#~ msgid "CDD" -#~ msgstr "CDD" - -#, python-format -#~ msgid "Change %(name)s configuration" -#~ msgstr "Modifier la configuration de %(name)s" - -#, python-format -#~ msgid "Change %(name)s custom mail template" -#~ msgstr "Modifier le template d'email personnalisé %(name)s" - -#~ msgid "Role: ADRE Secretaries" -#~ msgstr "Rôle: Secrétaires ADRE" - -#~ msgid "Role: ADRE secretary" -#~ msgstr "Rôle: Secrétaire ADRE" - -#~ msgid "Template title" -#~ msgstr "Intitulé du template" diff --git a/migrations/0237_alter_doctorateadmission_international_scholarship_and_more.py b/migrations/0237_alter_doctorateadmission_international_scholarship_and_more.py new file mode 100644 index 000000000..4b7cf7b78 --- /dev/null +++ b/migrations/0237_alter_doctorateadmission_international_scholarship_and_more.py @@ -0,0 +1,63 @@ +# Generated by Django 4.2.16 on 2025-01-07 17:52 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("reference", "0019_scholarship"), + ("admission", "0236_parcours_doctoral_refactoring"), + ] + + operations = [ + migrations.AlterField( + model_name="doctorateadmission", + name="international_scholarship", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="reference.scholarship", + verbose_name="International scholarship", + ), + ), + migrations.AlterField( + model_name="generaleducationadmission", + name="double_degree_scholarship", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="reference.scholarship", + verbose_name="Dual degree scholarship", + ), + ), + migrations.AlterField( + model_name="generaleducationadmission", + name="erasmus_mundus_scholarship", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="reference.scholarship", + verbose_name="Erasmus Mundus scholarship", + ), + ), + migrations.AlterField( + model_name="generaleducationadmission", + name="international_scholarship", + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.PROTECT, + related_name="+", + to="reference.scholarship", + verbose_name="International scholarship", + ), + ), + ] diff --git a/migrations/0238_delete_scholarship.py b/migrations/0238_delete_scholarship.py new file mode 100644 index 000000000..69d043402 --- /dev/null +++ b/migrations/0238_delete_scholarship.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.16 on 2025-01-07 17:52 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ( + "admission", + "0237_alter_doctorateadmission_international_scholarship_and_more", + ), + ("parcours_doctoral", "0003_alter_parcoursdoctoral_international_scholarship"), + ] + + operations = [ + migrations.DeleteModel( + name="Scholarship", + ), + ] diff --git a/models/__init__.py b/models/__init__.py index 0865b3083..367a4bb70 100644 --- a/models/__init__.py +++ b/models/__init__.py @@ -25,19 +25,25 @@ # ############################################################################## try: - from .doctorate import DoctorateAdmission - from .actor import SupervisionActor from admission.ddd.admission.enums.type_demande import TypeDemande - from .entity_proxy import EntityProxy - from .task import AdmissionTask + from .accounting import Accounting - from .scholarship import Scholarship - from .continuing_education import ContinuingEducationAdmission, ContinuingEducationAdmissionProxy - from .general_education import GeneralEducationAdmission, GeneralEducationAdmissionProxy - from .form_item import AdmissionFormItemInstantiation, AdmissionFormItem + from .actor import SupervisionActor from .base import AdmissionViewer - from .visa import DiplomaticPost + from .continuing_education import ( + ContinuingEducationAdmission, + ContinuingEducationAdmissionProxy, + ) + from .doctorate import DoctorateAdmission + from .entity_proxy import EntityProxy from .epc_injection import EPCInjection + from .form_item import AdmissionFormItem, AdmissionFormItemInstantiation + from .general_education import ( + GeneralEducationAdmission, + GeneralEducationAdmissionProxy, + ) + from .task import AdmissionTask + from .visa import DiplomaticPost __all__ = [ "DoctorateAdmission", @@ -46,7 +52,6 @@ "EntityProxy", "AdmissionTask", "Accounting", - "Scholarship", "ContinuingEducationAdmission", "ContinuingEducationAdmissionProxy", "GeneralEducationAdmission", diff --git a/models/actor.py b/models/actor.py index f6aeb3f75..89b30fa36 100644 --- a/models/actor.py +++ b/models/actor.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2023 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,12 +25,12 @@ # ############################################################################## from django.db import models from django.utils.translation import gettext_lazy as _ - -from admission.models import DoctorateAdmission -from admission.models.enums.actor_type import ActorType from osis_document.contrib import FileField from osis_signature.models import Actor +from admission.models.doctorate import DoctorateAdmission +from admission.models.enums.actor_type import ActorType + def actor_upload_directory_path(instance: 'SupervisionActor', filename): """Return the file upload directory path.""" diff --git a/models/doctorate.py b/models/doctorate.py index deda69f39..4da20f77b 100644 --- a/models/doctorate.py +++ b/models/doctorate.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,15 +28,16 @@ from django.contrib.postgres.fields import ArrayField from django.core.cache import cache -from django.core.validators import MinValueValidator, MaxValueValidator +from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.db.models import OuterRef, Prefetch from django.utils.datetime_safe import date from django.utils.translation import gettext_lazy as _ +from osis_document.contrib import FileField from osis_signature.contrib.fields import SignatureProcessField from rest_framework.settings import api_settings -from admission.ddd import DUREE_MINIMALE_PROGRAMME, DUREE_MAXIMALE_PROGRAMME +from admission.ddd import DUREE_MAXIMALE_PROGRAMME, DUREE_MINIMALE_PROGRAMME from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( ChoixCommissionProximiteCDEouCLSM, ChoixCommissionProximiteCDSS, @@ -47,17 +48,20 @@ ChoixTypeFinancement, ) from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( - DerogationFinancement, BesoinDeDerogation, - DroitsInscriptionMontant, + DerogationFinancement, DispenseOuDroitsMajores, + DroitsInscriptionMontant, MobiliteNombreDeMois, ) -from admission.ddd.admission.doctorat.validation.domain.model.enums import ChoixStatutCDD, ChoixStatutSIC +from admission.ddd.admission.doctorat.validation.domain.model.enums import ( + ChoixStatutCDD, + ChoixStatutSIC, +) from admission.ddd.admission.domain.model.enums.equivalence import ( - TypeEquivalenceTitreAcces, - StatutEquivalenceTitreAcces, EtatEquivalenceTitreAcces, + StatutEquivalenceTitreAcces, + TypeEquivalenceTitreAcces, ) from admission.ddd.admission.dtos.conditions import InfosDetermineesDTO from base.forms.utils.file_field import PDF_MIME_TYPE @@ -71,7 +75,7 @@ from ddd.logic.financabilite.domain.model.enums.situation import SituationFinancabilite from epc.models.enums.condition_acces import ConditionAcces from osis_common.ddd.interface import BusinessException -from osis_document.contrib import FileField + from .base import BaseAdmission, BaseAdmissionQuerySet, admission_directory_path __all__ = [ @@ -338,7 +342,7 @@ class DoctorateAdmission(BaseAdmission): blank=True, ) international_scholarship = models.ForeignKey( - to="admission.Scholarship", + to="reference.Scholarship", verbose_name=_("International scholarship"), related_name="+", on_delete=models.PROTECT, @@ -707,9 +711,9 @@ def save(self, *args, **kwargs) -> None: def update_detailed_status(self, author: 'Person' = None): from admission.ddd.admission.doctorat.preparation.commands import ( + DeterminerAnneeAcademiqueEtPotQuery, VerifierProjetQuery, VerifierPropositionQuery, - DeterminerAnneeAcademiqueEtPotQuery, ) from admission.utils import gather_business_exceptions from infrastructure.messages_bus import message_bus_instance diff --git a/models/general_education.py b/models/general_education.py index 8e9e00c75..5136d30fc 100644 --- a/models/general_education.py +++ b/models/general_education.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,29 +27,33 @@ from contextlib import suppress from django.contrib.postgres.fields import ArrayField -from django.core.validators import MinValueValidator, MaxValueValidator +from django.core.validators import MaxValueValidator, MinValueValidator from django.db import models from django.utils.translation import gettext_lazy as _ from osis_document.contrib import FileField from rest_framework.settings import api_settings -from admission.models.base import BaseAdmission, BaseAdmissionQuerySet, admission_directory_path -from admission.ddd import DUREE_MINIMALE_PROGRAMME, DUREE_MAXIMALE_PROGRAMME +from admission.ddd import DUREE_MAXIMALE_PROGRAMME, DUREE_MINIMALE_PROGRAMME from admission.ddd.admission.domain.model.enums.equivalence import ( - TypeEquivalenceTitreAcces, - StatutEquivalenceTitreAcces, EtatEquivalenceTitreAcces, + StatutEquivalenceTitreAcces, + TypeEquivalenceTitreAcces, ) from admission.ddd.admission.dtos.conditions import InfosDetermineesDTO from admission.ddd.admission.formation_generale.domain.model.enums import ( - ChoixStatutPropositionGenerale, - PoursuiteDeCycle, BesoinDeDerogation, - DroitsInscriptionMontant, + ChoixStatutPropositionGenerale, + DerogationFinancement, DispenseOuDroitsMajores, + DroitsInscriptionMontant, MobiliteNombreDeMois, + PoursuiteDeCycle, TypeDeRefus, - DerogationFinancement, +) +from admission.models.base import ( + BaseAdmission, + BaseAdmissionQuerySet, + admission_directory_path, ) from base.forms.utils.file_field import PDF_MIME_TYPE from base.models.academic_year import AcademicYear @@ -69,7 +73,7 @@ class GeneralEducationAdmission(BaseAdmission): ) double_degree_scholarship = models.ForeignKey( - to="admission.Scholarship", + to="reference.Scholarship", verbose_name=_("Dual degree scholarship"), related_name="+", on_delete=models.PROTECT, @@ -78,7 +82,7 @@ class GeneralEducationAdmission(BaseAdmission): ) international_scholarship = models.ForeignKey( - to="admission.Scholarship", + to="reference.Scholarship", verbose_name=_("International scholarship"), related_name="+", on_delete=models.PROTECT, @@ -87,7 +91,7 @@ class GeneralEducationAdmission(BaseAdmission): ) erasmus_mundus_scholarship = models.ForeignKey( - to="admission.Scholarship", + to="reference.Scholarship", verbose_name=_("Erasmus Mundus scholarship"), related_name="+", on_delete=models.PROTECT, @@ -475,8 +479,8 @@ class Meta: def update_detailed_status(self, author: 'Person' = None): """Gather exceptions from verification and update determined pool and academic year""" from admission.ddd.admission.formation_generale.commands import ( - VerifierPropositionQuery, DeterminerAnneeAcademiqueEtPotQuery, + VerifierPropositionQuery, ) from admission.utils import gather_business_exceptions from infrastructure.messages_bus import message_bus_instance diff --git a/models/scholarship.py b/models/scholarship.py deleted file mode 100644 index f93f0b052..000000000 --- a/models/scholarship.py +++ /dev/null @@ -1,67 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -import uuid as uuid -from django.db import models -from django.utils.translation import gettext_lazy as _, pgettext_lazy - -from admission.ddd.admission.enums.type_bourse import TypeBourse - - -class Scholarship(models.Model): - uuid = models.UUIDField( - default=uuid.uuid4, - editable=False, - primary_key=True, - ) - - short_name = models.CharField( - verbose_name=_('Short name'), - max_length=50, - ) - - long_name = models.CharField( - max_length=255, - verbose_name=_('Long name'), - blank=True, - default='', - ) - - disabled = models.BooleanField( - verbose_name=_('Disabled'), - default=False, - ) - - type = models.CharField( - verbose_name=_('Type'), - choices=TypeBourse.choices(), - max_length=50, - ) - - class Meta: - verbose_name = pgettext_lazy('admission model', 'Scholarship') - - def __str__(self): - return self.short_name diff --git a/schema.yml b/schema.yml index 2369836f7..4cf678013 100644 --- a/schema.yml +++ b/schema.yml @@ -1,7 +1,7 @@ openapi: 3.0.0 info: title: Admission API - version: 1.0.110 + version: 1.0.113 description: This API delivers data for the Admission project. contact: name: UCLouvain - OSIS @@ -4234,107 +4234,6 @@ paths: $ref: '#/components/responses/NotFound' tags: - autocomplete - /autocomplete/{scholarship_type}/scholarship: - get: - operationId: listScholarships - description: Autocomplete scholarships - parameters: - - name: scholarship_type - in: path - required: true - description: '' - schema: - type: string - - name: limit - required: false - in: query - description: Number of results to return per page. - schema: - type: integer - - name: offset - required: false - in: query - description: The initial index from which to return the results. - schema: - type: integer - - name: search - required: false - in: query - description: The term to search the scholarship on (short or long name) - schema: - type: string - - $ref: '#/components/parameters/Accept-Language' - - $ref: '#/components/parameters/X-User-FirstName' - - $ref: '#/components/parameters/X-User-LastName' - - $ref: '#/components/parameters/X-User-Email' - - $ref: '#/components/parameters/X-User-GlobalID' - responses: - '200': - content: - application/json: - schema: - type: object - required: - - count - - results - properties: - count: - type: integer - example: 123 - next: - type: string - nullable: true - format: uri - example: http://api.example.org/accounts/?offset=400&limit=100 - previous: - type: string - nullable: true - format: uri - example: http://api.example.org/accounts/?offset=200&limit=100 - results: - type: array - items: - $ref: '#/components/schemas/Scholarship' - description: '' - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '404': - $ref: '#/components/responses/NotFound' - tags: - - autocomplete - /scholarship/{uuid}: - get: - operationId: retrieveScholarship - description: Retrieves a scholarship - parameters: - - name: uuid - in: path - required: true - description: A UUID string identifying this Bourse. - schema: - type: string - - $ref: '#/components/parameters/Accept-Language' - - $ref: '#/components/parameters/X-User-FirstName' - - $ref: '#/components/parameters/X-User-LastName' - - $ref: '#/components/parameters/X-User-Email' - - $ref: '#/components/parameters/X-User-GlobalID' - responses: - '200': - content: - application/json: - schema: - $ref: '#/components/schemas/Scholarship' - description: '' - '400': - $ref: '#/components/responses/BadRequest' - '401': - $ref: '#/components/responses/Unauthorized' - '404': - $ref: '#/components/responses/NotFound' - tags: - - scholarship /campus: get: operationId: listCampus @@ -8694,28 +8593,6 @@ components: - name_en - email - countries_iso_codes - Scholarship: - type: object - properties: - uuid: - type: string - readOnly: true - short_name: - type: string - maxLength: 50 - long_name: - type: string - maxLength: 255 - type: - enum: - - DOUBLE_TRIPLE_DIPLOMATION - - BOURSE_INTERNATIONALE_DOCTORAT - - BOURSE_INTERNATIONALE_FORMATION_GENERALE - - ERASMUS_MUNDUS - type: string - required: - - short_name - - type Campus: type: object properties: diff --git a/tests/api/views/autocomplete/test_scholarship.py b/tests/api/views/autocomplete/test_scholarship.py deleted file mode 100644 index 5ee1c3741..000000000 --- a/tests/api/views/autocomplete/test_scholarship.py +++ /dev/null @@ -1,115 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2023 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -from django.shortcuts import resolve_url -from django.test import override_settings -from rest_framework.test import APITestCase - -from admission.ddd.admission.enums.type_bourse import TypeBourse -from admission.tests.factories.scholarship import ( - DoubleDegreeScholarshipFactory, - ErasmusMundusScholarshipFactory, - InternationalScholarshipFactory, -) -from base.tests.factories.user import UserFactory - - -@override_settings(ROOT_URLCONF='admission.api.url_v1') -class ScholarshipAutocompleteTestCase(APITestCase): - @classmethod - def setUpTestData(cls): - cls.scholarships = [ - DoubleDegreeScholarshipFactory(short_name='DDS-1', long_name='Dual degree scholarship 1'), - DoubleDegreeScholarshipFactory(short_name='DDS-2', long_name='Dual degree scholarship 2'), - InternationalScholarshipFactory(short_name='IS-1', long_name='International scholarship 1', disabled=True), - InternationalScholarshipFactory(short_name='IS-1bis', long_name='International scholarship 1bis'), - InternationalScholarshipFactory(short_name='IS-2', long_name='International scholarship 2'), - InternationalScholarshipFactory(short_name='IS-2bis', long_name='International scholarship 2bis'), - InternationalScholarshipFactory(short_name='AIS', long_name=''), - ErasmusMundusScholarshipFactory(short_name='EMS-1', long_name='Erasmus Mundus scholarship 1'), - ErasmusMundusScholarshipFactory(short_name='EMS-2', long_name='Erasmus Mundus scholarship 2'), - ] - cls.user = UserFactory() - - def test_autocomplete_scholarship_with_specific_type(self): - self.client.force_authenticate(user=self.user) - response = self.client.get( - resolve_url( - 'autocomplete-scholarships', - scholarship_type=TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, - ), - format='json', - ) - self.assertEqual(response.status_code, 200, response.content) - self.assertEqual(response.json()['count'], 4) - - self.assertEqual( - response.json()['results'], - [ - { - 'uuid': str(scholarship.uuid), - 'short_name': scholarship.short_name, - 'long_name': scholarship.long_name, - 'type': scholarship.type, - } - for scholarship in [ - self.scholarships[6], - self.scholarships[3], - self.scholarships[4], - self.scholarships[5], - ] - ], - ) - - def test_autocomplete_scholarship_with_specific_type_and_search(self): - self.client.force_authenticate(user=self.user) - response = self.client.get( - resolve_url( - 'autocomplete-scholarships', - scholarship_type=TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name, - ), - format='json', - data={ - 'search': '2', - }, - ) - self.assertEqual(response.status_code, 200, response.content) - self.assertEqual(response.json()['count'], 2) - - self.assertEqual( - response.json()['results'], - [ - { - 'uuid': str(scholarship.uuid), - 'short_name': scholarship.short_name, - 'long_name': scholarship.long_name, - 'type': scholarship.type, - } - for scholarship in [ - self.scholarships[4], - self.scholarships[5], - ] - ], - ) diff --git a/tests/api/views/references/test_scholarship.py b/tests/api/views/references/test_scholarship.py deleted file mode 100644 index e9096ef77..000000000 --- a/tests/api/views/references/test_scholarship.py +++ /dev/null @@ -1,69 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## -import uuid - -from django.shortcuts import resolve_url -from django.test import override_settings -from rest_framework.test import APITestCase - -from admission.tests.factories.scholarship import DoubleDegreeScholarshipFactory -from base.tests.factories.user import UserFactory - - -@override_settings(ROOT_URLCONF='admission.api.url_v1') -class ScholarshipReferenceTestCase(APITestCase): - @classmethod - def setUpTestData(cls): - cls.scholarships = [ - DoubleDegreeScholarshipFactory(short_name='DDS-1', long_name='Dual degree scholarship 1'), - DoubleDegreeScholarshipFactory(short_name='DDS-2', long_name='Dual degree scholarship 2'), - ] - cls.user = UserFactory() - - def test_retrieve_scholarship_if_valid_uuid(self): - self.client.force_authenticate(user=self.user) - response = self.client.get( - resolve_url('retrieve-scholarship', uuid=str(self.scholarships[0].uuid)), - format='json', - ) - self.assertEqual(response.status_code, 200) - self.assertEqual( - response.json(), - { - 'uuid': str(self.scholarships[0].uuid), - 'short_name': self.scholarships[0].short_name, - 'long_name': self.scholarships[0].long_name, - 'type': self.scholarships[0].type, - }, - ) - - def test_return_404_if_unknown_uuid(self): - self.client.force_authenticate(user=self.user) - response = self.client.get( - resolve_url('retrieve-scholarship', uuid=str(uuid.uuid4())), - format='json', - ) - self.assertEqual(response.status_code, 404) diff --git a/tests/api/views/test_specific_questions.py b/tests/api/views/test_specific_questions.py index e7ad88ae7..128f198b2 100644 --- a/tests/api/views/test_specific_questions.py +++ b/tests/api/views/test_specific_questions.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -34,9 +34,10 @@ from rest_framework import status from rest_framework.test import APITestCase -from admission.models import ContinuingEducationAdmission, GeneralEducationAdmission from admission.ddd import EN_ISO_CODE, FR_ISO_CODE -from admission.ddd.admission.domain.validator.exceptions import PosteDiplomatiqueNonTrouveException +from admission.ddd.admission.domain.validator.exceptions import ( + PosteDiplomatiqueNonTrouveException, +) from admission.ddd.admission.enums import CritereItemFormulaireNationaliteDiplome from admission.ddd.admission.enums.question_specifique import ( CritereItemFormulaireFormation, @@ -50,9 +51,12 @@ ChoixInscriptionATitre, ChoixTypeAdresseFacturation, ) +from admission.models import ContinuingEducationAdmission, GeneralEducationAdmission from admission.tests.factories import DoctorateAdmissionFactory from admission.tests.factories.calendar import AdmissionAcademicCalendarFactory -from admission.tests.factories.continuing_education import ContinuingEducationAdmissionFactory +from admission.tests.factories.continuing_education import ( + ContinuingEducationAdmissionFactory, +) from admission.tests.factories.diplomatic_post import DiplomaticPostFactory from admission.tests.factories.form_item import ( AdmissionFormItemInstantiationFactory, @@ -62,8 +66,10 @@ ) from admission.tests.factories.general_education import GeneralEducationAdmissionFactory from admission.tests.factories.roles import CandidateFactory -from admission.tests.factories.scholarship import InternationalScholarshipFactory -from admission.tests.factories.secondary_studies import BelgianHighSchoolDiplomaFactory, ForeignHighSchoolDiplomaFactory +from admission.tests.factories.secondary_studies import ( + BelgianHighSchoolDiplomaFactory, + ForeignHighSchoolDiplomaFactory, +) from admission.tests.factories.supervision import PromoterFactory from base.models.enums.education_group_types import TrainingType from base.models.enums.entity_type import EntityType @@ -77,6 +83,7 @@ from osis_profile.tests.factories.curriculum import EducationalExperienceFactory from reference.tests.factories.country import CountryFactory from reference.tests.factories.language import LanguageFactory +from reference.tests.factories.scholarship import InternationalScholarshipFactory class BaseDoctorateSpecificQuestionListApiTestCase(APITestCase): diff --git a/tests/api/views/test_training_choice.py b/tests/api/views/test_training_choice.py index 3e900acd6..adacf3ffb 100644 --- a/tests/api/views/test_training_choice.py +++ b/tests/api/views/test_training_choice.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -37,26 +37,35 @@ from rest_framework import status from rest_framework.test import APITestCase -from admission.models import ContinuingEducationAdmission, DoctorateAdmission, GeneralEducationAdmission -from admission.models.base import REFERENCE_SEQ_NAME from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( ChoixStatutPropositionDoctorale, ChoixTypeAdmission, ) -from admission.ddd.admission.doctorat.preparation.domain.validator import exceptions as doctorate_education_exceptions +from admission.ddd.admission.doctorat.preparation.domain.validator import ( + exceptions as doctorate_education_exceptions, +) from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( DoctoratNonTrouveException, ) -from admission.ddd.admission.domain.validator.exceptions import BourseNonTrouveeException from admission.ddd.admission.formation_continue.domain.model.enums import ( - ChoixStatutPropositionContinue, ChoixMoyensDecouverteFormation, + ChoixStatutPropositionContinue, +) +from admission.ddd.admission.formation_continue.domain.validator import ( + exceptions as continuing_education_exceptions, ) -from admission.ddd.admission.formation_continue.domain.validator import exceptions as continuing_education_exceptions from admission.ddd.admission.formation_generale.domain.model.enums import ( ChoixStatutPropositionGenerale, ) -from admission.ddd.admission.formation_generale.domain.validator import exceptions as general_education_exceptions +from admission.ddd.admission.formation_generale.domain.validator import ( + exceptions as general_education_exceptions, +) +from admission.models import ( + ContinuingEducationAdmission, + DoctorateAdmission, + GeneralEducationAdmission, +) +from admission.models.base import REFERENCE_SEQ_NAME from admission.tests.factories import DoctorateAdmissionFactory from admission.tests.factories.calendar import AdmissionAcademicCalendarFactory from admission.tests.factories.continuing_education import ( @@ -71,17 +80,18 @@ ) from admission.tests.factories.general_education import GeneralEducationAdmissionFactory from admission.tests.factories.roles import CandidateFactory -from admission.tests.factories.scholarship import ( - DoubleDegreeScholarshipFactory, - ErasmusMundusScholarshipFactory, - InternationalScholarshipFactory, -) from admission.tests.factories.supervision import CaMemberFactory, PromoterFactory from base.models.enums.entity_type import EntityType from base.tests import QueriesAssertionsMixin from base.tests.factories.education_group_year import Master120TrainingFactory from base.tests.factories.entity_version import EntityVersionFactory from base.tests.factories.person import PersonFactory +from ddd.logic.reference.domain.validator.exceptions import BourseNonTrouveeException +from reference.tests.factories.scholarship import ( + DoubleDegreeScholarshipFactory, + ErasmusMundusScholarshipFactory, + InternationalScholarshipFactory, +) def create_default_propositions_in_progress(candidate): diff --git a/tests/commands/doctorate_education/test_get_proposition_dto_for_gestionnaire.py b/tests/commands/doctorate_education/test_get_proposition_dto_for_gestionnaire.py index 62d2a3cda..db86c0408 100644 --- a/tests/commands/doctorate_education/test_get_proposition_dto_for_gestionnaire.py +++ b/tests/commands/doctorate_education/test_get_proposition_dto_for_gestionnaire.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,30 +32,40 @@ from django.test import TestCase, override_settings from osis_history.models import HistoryEntry -from admission.models import DoctorateAdmission -from admission.ddd.admission.doctorat.preparation.commands import RecupererPropositionGestionnaireQuery -from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ENTITY_CDE -from admission.ddd.admission.doctorat.preparation.domain.model.enums import ChoixStatutPropositionDoctorale +from admission.ddd.admission.doctorat.preparation.commands import ( + RecupererPropositionGestionnaireQuery, +) +from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( + ENTITY_CDE, +) +from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( + ChoixStatutPropositionDoctorale, +) from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( - TypeDeRefus, BesoinDeDerogation, - DroitsInscriptionMontant, + DerogationFinancement, DispenseOuDroitsMajores, + DroitsInscriptionMontant, MobiliteNombreDeMois, - DerogationFinancement, + TypeDeRefus, +) +from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( + PropositionNonTrouveeException, ) -from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import PropositionNonTrouveeException from admission.ddd.admission.doctorat.preparation.dtos import DoctoratFormationDTO -from admission.ddd.admission.doctorat.preparation.dtos.proposition import PropositionGestionnaireDTO +from admission.ddd.admission.doctorat.preparation.dtos.proposition import ( + PropositionGestionnaireDTO, +) from admission.ddd.admission.domain.model.enums.equivalence import ( - TypeEquivalenceTitreAcces, - StatutEquivalenceTitreAcces, EtatEquivalenceTitreAcces, + StatutEquivalenceTitreAcces, + TypeEquivalenceTitreAcces, ) -from admission.ddd.admission.dtos.bourse import BourseDTO -from admission.ddd.admission.formation_generale.domain.model.enums import DROITS_INSCRIPTION_MONTANT_VALEURS +from admission.ddd.admission.formation_generale.domain.model.enums import ( + DROITS_INSCRIPTION_MONTANT_VALEURS, +) +from admission.models import DoctorateAdmission from admission.tests.factories import DoctorateAdmissionFactory -from admission.tests.factories.scholarship import DoctorateScholarshipFactory from base.tests.factories.academic_year import AcademicYearFactory from base.tests.factories.entity import EntityFactory from base.tests.factories.entity_version import EntityVersionFactory @@ -64,9 +74,11 @@ from base.tests.factories.student import StudentFactory from ddd.logic.financabilite.domain.model.enums.etat import EtatFinancabilite from ddd.logic.financabilite.domain.model.enums.situation import SituationFinancabilite +from ddd.logic.reference.dtos.bourse import BourseDTO from epc.models.enums.condition_acces import ConditionAcces from infrastructure.messages_bus import message_bus_instance from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import DoctorateScholarshipFactory @override_settings(OSIS_DOCUMENT_BASE_URL='http://dummyurl/') diff --git a/tests/commands/general_education/test_get_proposition_dto_for_gestionnaire.py b/tests/commands/general_education/test_get_proposition_dto_for_gestionnaire.py index b58c3f077..d08179387 100644 --- a/tests/commands/general_education/test_get_proposition_dto_for_gestionnaire.py +++ b/tests/commands/general_education/test_get_proposition_dto_for_gestionnaire.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,35 +32,47 @@ from django.utils.translation import pgettext from osis_history.models import HistoryEntry -from admission.models import GeneralEducationAdmission -from admission.ddd.admission.dtos.bourse import BourseDTO from admission.ddd.admission.dtos.campus import CampusDTO -from admission.ddd.admission.dtos.formation import FormationDTO, BaseFormationDTO +from admission.ddd.admission.dtos.formation import BaseFormationDTO, FormationDTO from admission.ddd.admission.enums import TypeSituationAssimilation -from admission.ddd.admission.formation_continue.domain.validator.exceptions import PropositionNonTrouveeException -from admission.ddd.admission.formation_generale.commands import RecupererPropositionGestionnaireQuery -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale -from admission.ddd.admission.formation_generale.domain.validator.exceptions import PropositionNonTrouveeException -from admission.ddd.admission.formation_generale.dtos.condition_approbation import ConditionComplementaireApprobationDTO -from admission.ddd.admission.formation_generale.dtos.proposition import PropositionGestionnaireDTO +from admission.ddd.admission.formation_continue.domain.validator.exceptions import ( + PropositionNonTrouveeException, +) +from admission.ddd.admission.formation_generale.commands import ( + RecupererPropositionGestionnaireQuery, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) +from admission.ddd.admission.formation_generale.domain.validator.exceptions import ( + PropositionNonTrouveeException, +) +from admission.ddd.admission.formation_generale.dtos.condition_approbation import ( + ConditionComplementaireApprobationDTO, +) +from admission.ddd.admission.formation_generale.dtos.proposition import ( + PropositionGestionnaireDTO, +) +from admission.models import GeneralEducationAdmission from admission.tests.factories.faculty_decision import ( - RefusalReasonFactory, AdditionalApprovalConditionFactory, FreeAdditionalApprovalConditionFactory, + RefusalReasonFactory, ) from admission.tests.factories.general_education import ( GeneralEducationAdmissionFactory, GeneralEducationTrainingFactory, ) -from admission.tests.factories.scholarship import ErasmusMundusScholarshipFactory from base.models.enums.organization_type import MAIN from base.tests.factories.entity import EntityFactory from base.tests.factories.entity_version import EntityVersionFactory from base.tests.factories.learning_unit_year import LearningUnitYearFactory from base.tests.factories.student import StudentFactory +from ddd.logic.reference.dtos.bourse import BourseDTO from infrastructure.messages_bus import message_bus_instance from program_management.models.education_group_version import EducationGroupVersion from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import ErasmusMundusScholarshipFactory @override_settings(OSIS_DOCUMENT_BASE_URL='http://dummyurl/') diff --git a/tests/factories/general_education.py b/tests/factories/general_education.py index ea871f450..855c62235 100644 --- a/tests/factories/general_education.py +++ b/tests/factories/general_education.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,24 +27,19 @@ import factory.fuzzy -from admission.models import GeneralEducationAdmission -from admission.models.general_education import AdmissionPrerequisiteCourses from admission.ddd.admission.formation_generale.domain.model.enums import ( - ChoixStatutPropositionGenerale, ChoixStatutChecklist, + ChoixStatutPropositionGenerale, OngletsChecklist, ) from admission.infrastructure.admission.domain.service.annee_inscription_formation import ( AnneeInscriptionFormationTranslator, ) +from admission.models import GeneralEducationAdmission +from admission.models.general_education import AdmissionPrerequisiteCourses from admission.tests.factories.accounting import AccountingFactory from admission.tests.factories.person import CompletePersonForBachelorFactory from admission.tests.factories.roles import CandidateFactory -from admission.tests.factories.scholarship import ( - DoubleDegreeScholarshipFactory, - ErasmusMundusScholarshipFactory, - InternationalScholarshipFactory, -) from admission.tests.factories.utils import generate_proposition_reference from base.models.enums import education_group_categories from base.models.enums.education_group_types import TrainingType @@ -53,7 +48,14 @@ from base.tests.factories.education_group_year import EducationGroupYearFactory from base.tests.factories.learning_unit_year import LearningUnitYearFullFactory from base.tests.factories.person import PersonFactory -from program_management.tests.factories.education_group_version import EducationGroupVersionFactory +from program_management.tests.factories.education_group_version import ( + EducationGroupVersionFactory, +) +from reference.tests.factories.scholarship import ( + DoubleDegreeScholarshipFactory, + ErasmusMundusScholarshipFactory, + InternationalScholarshipFactory, +) class GeneralEducationTrainingFactory(EducationGroupYearFactory): diff --git a/tests/factories/scholarship.py b/tests/factories/scholarship.py deleted file mode 100644 index ce8dcdf91..000000000 --- a/tests/factories/scholarship.py +++ /dev/null @@ -1,72 +0,0 @@ -# ############################################################################## -# -# OSIS stands for Open Student Information System. It's an application -# designed to manage the core business of higher education institutions, -# such as universities, faculties, institutes and professional schools. -# The core business involves the administration of students, teachers, -# courses, programs and so on. -# -# Copyright (C) 2015-2022 Université catholique de Louvain (http://www.uclouvain.be) -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# A copy of this license - GNU General Public License - is available -# at the root of the source code of this program. If not, -# see http://www.gnu.org/licenses/. -# -# ############################################################################## - -import factory -from factory.fuzzy import FuzzyText - -from admission.models import Scholarship -from admission.ddd.admission.enums.type_bourse import TypeBourse - - -class ScholarshipFactory(factory.django.DjangoModelFactory): - class Meta: - model = Scholarship - - -class DoubleDegreeScholarshipFactory(factory.django.DjangoModelFactory): - type = TypeBourse.DOUBLE_TRIPLE_DIPLOMATION.name - short_name = FuzzyText(length=20) - long_name = FuzzyText(length=40) - - class Meta: - model = Scholarship - - -class InternationalScholarshipFactory(factory.django.DjangoModelFactory): - type = TypeBourse.BOURSE_INTERNATIONALE_FORMATION_GENERALE.name - short_name = FuzzyText(length=20) - long_name = FuzzyText(length=40) - - class Meta: - model = Scholarship - - -class DoctorateScholarshipFactory(factory.django.DjangoModelFactory): - type = TypeBourse.BOURSE_INTERNATIONALE_DOCTORAT.name - short_name = FuzzyText(length=20) - long_name = FuzzyText(length=40) - - class Meta: - model = Scholarship - - -class ErasmusMundusScholarshipFactory(factory.django.DjangoModelFactory): - type = TypeBourse.ERASMUS_MUNDUS.name - short_name = FuzzyText(length=20) - long_name = FuzzyText(length=40) - - class Meta: - model = Scholarship diff --git a/tests/views/cdd/test_list.py b/tests/views/cdd/test_list.py index 2b8426577..a712abaa8 100644 --- a/tests/views/cdd/test_list.py +++ b/tests/views/cdd/test_list.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,23 +35,31 @@ from django.urls import reverse from django.utils.translation import gettext, gettext_lazy -from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ENTITY_CDE, ENTITY_CDSS, \ - SIGLE_SCIENCES, ENTITY_CLSM, ENTITY_SCIENCES -from admission.models import DoctorateAdmission from admission.ddd import FR_ISO_CODE +from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( + ENTITY_CDE, + ENTITY_CDSS, + ENTITY_CLSM, + ENTITY_SCIENCES, + SIGLE_SCIENCES, +) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( BourseRecherche, + ChoixCommissionProximiteCDEouCLSM, + ChoixCommissionProximiteCDSS, + ChoixSousDomaineSciences, ChoixStatutPropositionDoctorale, ChoixTypeAdmission, ChoixTypeContratTravail, ChoixTypeFinancement, - ChoixCommissionProximiteCDEouCLSM, - ChoixCommissionProximiteCDSS, - ChoixSousDomaineSciences, ) -from admission.ddd.admission.doctorat.validation.domain.model.enums import ChoixStatutCDD, ChoixStatutSIC +from admission.ddd.admission.doctorat.validation.domain.model.enums import ( + ChoixStatutCDD, + ChoixStatutSIC, +) from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist from admission.forms import ALL_EMPTY_CHOICE, ALL_FEMININE_EMPTY_CHOICE +from admission.models import DoctorateAdmission from admission.tests.factories import DoctorateAdmissionFactory from admission.tests.factories.roles import ( CandidateFactory, @@ -59,12 +67,6 @@ ProgramManagerRoleFactory, SicManagementRoleFactory, ) -from admission.tests.factories.scholarship import ( - DoctorateScholarshipFactory, - InternationalScholarshipFactory, - DoubleDegreeScholarshipFactory, - ErasmusMundusScholarshipFactory, -) from admission.tests.factories.supervision import PromoterFactory from base.models.enums.academic_calendar_type import AcademicCalendarTypes from base.models.enums.entity_type import EntityType @@ -76,6 +78,12 @@ from base.tests.factories.user import UserFactory from osis_profile import BE_ISO_CODE from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import ( + DoctorateScholarshipFactory, + DoubleDegreeScholarshipFactory, + ErasmusMundusScholarshipFactory, + InternationalScholarshipFactory, +) @override_settings(WAFFLE_CREATE_MISSING_SWITCHES=False) diff --git a/tests/views/common/form_tabs/training_choice/test_general.py b/tests/views/common/form_tabs/training_choice/test_general.py index 7a2853761..a44df1009 100644 --- a/tests/views/common/form_tabs/training_choice/test_general.py +++ b/tests/views/common/form_tabs/training_choice/test_general.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,26 +31,26 @@ from django.test import TestCase from rest_framework import status -from admission.models import GeneralEducationAdmission from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( ENTITY_CDE, ) from admission.ddd.admission.domain.enums import TypeFormation from admission.ddd.admission.enums import Onglets from admission.ddd.admission.enums.emplacement_document import OngletsDemande -from admission.ddd.admission.formation_generale.domain.model.enums import ChoixStatutPropositionGenerale +from admission.ddd.admission.formation_generale.domain.model.enums import ( + ChoixStatutPropositionGenerale, +) from admission.forms import EMPTY_CHOICE_AS_LIST -from admission.tests.factories.form_item import AdmissionFormItemInstantiationFactory, TextAdmissionFormItemFactory +from admission.models import GeneralEducationAdmission +from admission.tests.factories.form_item import ( + AdmissionFormItemInstantiationFactory, + TextAdmissionFormItemFactory, +) from admission.tests.factories.general_education import GeneralEducationAdmissionFactory from admission.tests.factories.roles import ( - SicManagementRoleFactory, CandidateFactory, ProgramManagerRoleFactory, -) -from admission.tests.factories.scholarship import ( - DoubleDegreeScholarshipFactory, - InternationalScholarshipFactory, - ErasmusMundusScholarshipFactory, + SicManagementRoleFactory, ) from base.forms.utils import FIELD_REQUIRED_MESSAGE from base.forms.utils.choice_field import BLANK_CHOICE_DISPLAY @@ -58,11 +58,21 @@ from base.models.enums.organization_type import MAIN from base.tests.factories.academic_year import AcademicYearFactory from base.tests.factories.campus import CampusFactory -from base.tests.factories.education_group_year import Master120TrainingFactory, EducationGroupYearBachelorFactory +from base.tests.factories.education_group_year import ( + EducationGroupYearBachelorFactory, + Master120TrainingFactory, +) from base.tests.factories.entity import EntityWithVersionFactory from base.tests.factories.entity_version import EntityVersionFactory -from program_management.tests.factories.education_group_version import EducationGroupVersionFactory +from program_management.tests.factories.education_group_version import ( + EducationGroupVersionFactory, +) from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import ( + DoubleDegreeScholarshipFactory, + ErasmusMundusScholarshipFactory, + InternationalScholarshipFactory, +) @freezegun.freeze_time('2021-12-01') diff --git a/tests/views/doctorate/cdd/test_list.py b/tests/views/doctorate/cdd/test_list.py index 62bb6dba1..4581db0a3 100644 --- a/tests/views/doctorate/cdd/test_list.py +++ b/tests/views/doctorate/cdd/test_list.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,28 +35,31 @@ from django.urls import reverse from django.utils.translation import gettext, gettext_lazy -from admission.models import DoctorateAdmission from admission.ddd import FR_ISO_CODE from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( ENTITY_CDE, ENTITY_CDSS, - SIGLE_SCIENCES, ENTITY_CLSM, ENTITY_SCIENCES, + SIGLE_SCIENCES, ) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( BourseRecherche, + ChoixCommissionProximiteCDEouCLSM, + ChoixCommissionProximiteCDSS, + ChoixSousDomaineSciences, ChoixStatutPropositionDoctorale, ChoixTypeAdmission, ChoixTypeContratTravail, ChoixTypeFinancement, - ChoixCommissionProximiteCDEouCLSM, - ChoixCommissionProximiteCDSS, - ChoixSousDomaineSciences, ) -from admission.ddd.admission.doctorat.validation.domain.model.enums import ChoixStatutCDD, ChoixStatutSIC +from admission.ddd.admission.doctorat.validation.domain.model.enums import ( + ChoixStatutCDD, + ChoixStatutSIC, +) from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist from admission.forms import ALL_EMPTY_CHOICE, ALL_FEMININE_EMPTY_CHOICE +from admission.models import DoctorateAdmission from admission.tests.factories import DoctorateAdmissionFactory from admission.tests.factories.roles import ( CandidateFactory, @@ -64,12 +67,6 @@ ProgramManagerRoleFactory, SicManagementRoleFactory, ) -from admission.tests.factories.scholarship import ( - DoctorateScholarshipFactory, - InternationalScholarshipFactory, - DoubleDegreeScholarshipFactory, - ErasmusMundusScholarshipFactory, -) from admission.tests.factories.supervision import PromoterFactory from base.models.enums.academic_calendar_type import AcademicCalendarTypes from base.models.enums.entity_type import EntityType @@ -81,6 +78,12 @@ from base.tests.factories.user import UserFactory from osis_profile import BE_ISO_CODE from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import ( + DoctorateScholarshipFactory, + DoubleDegreeScholarshipFactory, + ErasmusMundusScholarshipFactory, + InternationalScholarshipFactory, +) @override_settings(WAFFLE_CREATE_MISSING_SWITCHES=False) diff --git a/tests/views/doctorate/checklist/sic_decision/test_approval.py b/tests/views/doctorate/checklist/sic_decision/test_approval.py index 2589ab592..0d6b4fd1a 100644 --- a/tests/views/doctorate/checklist/sic_decision/test_approval.py +++ b/tests/views/doctorate/checklist/sic_decision/test_approval.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -32,23 +32,32 @@ from django.test import TestCase from osis_history.models import HistoryEntry +from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( + ENTITY_CDE, +) +from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( + ChoixStatutPropositionDoctorale, +) +from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( + ChoixStatutChecklist, +) +from admission.ddd.admission.enums.type_demande import TypeDemande from admission.models import DoctorateAdmission from admission.models.checklist import AdditionalApprovalCondition -from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ENTITY_CDE -from admission.ddd.admission.doctorat.preparation.domain.model.enums import ChoixStatutPropositionDoctorale -from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ChoixStatutChecklist -from admission.ddd.admission.enums.type_demande import TypeDemande from admission.tests.factories import DoctorateAdmissionFactory from admission.tests.factories.doctorate import DoctorateFactory from admission.tests.factories.person import CompletePersonFactory -from admission.tests.factories.roles import SicManagementRoleFactory, ProgramManagerRoleFactory -from admission.tests.factories.scholarship import DoctorateScholarshipFactory +from admission.tests.factories.roles import ( + ProgramManagerRoleFactory, + SicManagementRoleFactory, +) from admission.tests.views.doctorate.checklist.sic_decision.base import SicPatchMixin from base.tests.factories.academic_year import AcademicYearFactory from base.tests.factories.entity import EntityWithVersionFactory from base.tests.factories.entity_version import EntityVersionFactory from base.tests.factories.learning_unit_year import LearningUnitYearFactory from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import DoctorateScholarshipFactory @freezegun.freeze_time('2021-11-01') diff --git a/tests/views/general_education/checklist/sic_decision/test_approval.py b/tests/views/general_education/checklist/sic_decision/test_approval.py index 923f35f77..33a66ce77 100644 --- a/tests/views/general_education/checklist/sic_decision/test_approval.py +++ b/tests/views/general_education/checklist/sic_decision/test_approval.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -33,31 +33,41 @@ from django.utils.translation import gettext from osis_history.models import HistoryEntry -from admission.models import GeneralEducationAdmission -from admission.models.checklist import AdditionalApprovalCondition, FreeAdditionalApprovalCondition -from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ENTITY_CDE +from admission.ddd.admission.doctorat.preparation.domain.model.doctorat_formation import ( + ENTITY_CDE, +) from admission.ddd.admission.enums.type_demande import TypeDemande from admission.ddd.admission.formation_generale.domain.model.enums import ( - ChoixStatutPropositionGenerale, ChoixStatutChecklist, + ChoixStatutPropositionGenerale, +) +from admission.models import GeneralEducationAdmission +from admission.models.checklist import ( + AdditionalApprovalCondition, + FreeAdditionalApprovalCondition, ) from admission.tests.factories.faculty_decision import ( AdditionalApprovalConditionFactory, FreeAdditionalApprovalConditionFactory, ) from admission.tests.factories.general_education import ( - GeneralEducationTrainingFactory, GeneralEducationAdmissionFactory, + GeneralEducationTrainingFactory, ) from admission.tests.factories.person import CompletePersonFactory -from admission.tests.factories.roles import SicManagementRoleFactory, ProgramManagerRoleFactory -from admission.tests.factories.scholarship import ErasmusMundusScholarshipFactory -from admission.tests.views.general_education.checklist.sic_decision.base import SicPatchMixin +from admission.tests.factories.roles import ( + ProgramManagerRoleFactory, + SicManagementRoleFactory, +) +from admission.tests.views.general_education.checklist.sic_decision.base import ( + SicPatchMixin, +) from base.tests.factories.academic_year import AcademicYearFactory from base.tests.factories.entity import EntityWithVersionFactory from base.tests.factories.entity_version import EntityVersionFactory from base.tests.factories.learning_unit_year import LearningUnitYearFactory from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import ErasmusMundusScholarshipFactory @freezegun.freeze_time('2021-11-01') diff --git a/tests/views/test_excel_exports.py b/tests/views/test_excel_exports.py index 39047f57f..77a5ff493 100644 --- a/tests/views/test_excel_exports.py +++ b/tests/views/test_excel_exports.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,7 +35,8 @@ from django.contrib.auth.models import User from django.test import RequestFactory, TestCase, override_settings from django.urls import reverse -from django.utils.translation import gettext as _, pgettext +from django.utils.translation import gettext as _ +from django.utils.translation import pgettext from openpyxl.workbook import Workbook from openpyxl.worksheet.worksheet import Worksheet from osis_async.models import AsyncTask @@ -43,60 +44,67 @@ from osis_export.models import Export from osis_export.models.enums.types import ExportTypes -from admission.ddd.admission.doctorat.preparation.commands import ListerDemandesQuery as ListerDemandesDoctoralesQuery +from admission.ddd.admission.doctorat.preparation.commands import ( + ListerDemandesQuery as ListerDemandesDoctoralesQuery, +) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( + ChoixCommissionProximiteCDSS, ChoixStatutPropositionDoctorale, ChoixTypeAdmission, - ChoixCommissionProximiteCDSS, ChoixTypeFinancement, ) -from admission.ddd.admission.doctorat.preparation.dtos.liste import DemandeRechercheDTO as DemandeDoctoraleRechercheDTO -from admission.ddd.admission.dtos.liste import DemandeRechercheDTO, VisualiseurAdmissionDTO +from admission.ddd.admission.doctorat.preparation.dtos.liste import ( + DemandeRechercheDTO as DemandeDoctoraleRechercheDTO, +) +from admission.ddd.admission.dtos.liste import ( + DemandeRechercheDTO, + VisualiseurAdmissionDTO, +) from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist from admission.ddd.admission.enums.liste import TardiveModificationReorientationFiltre from admission.ddd.admission.enums.type_demande import TypeDemande -from admission.ddd.admission.formation_continue.commands import ListerDemandesQuery as ListerDemandesContinuesQuery -from admission.ddd.admission.formation_continue.domain.model.enums import ChoixEdition +from admission.ddd.admission.formation_continue.commands import ( + ListerDemandesQuery as ListerDemandesContinuesQuery, +) from admission.ddd.admission.formation_continue.domain.model.enums import ( + ChoixEdition, ChoixStatutPropositionContinue, +) +from admission.ddd.admission.formation_continue.domain.model.enums import ( OngletsChecklist as OngletsChecklistContinue, ) -from admission.ddd.admission.formation_continue.dtos.liste import DemandeRechercheDTO as DemandeContinueRechercheDTO +from admission.ddd.admission.formation_continue.dtos.liste import ( + DemandeRechercheDTO as DemandeContinueRechercheDTO, +) from admission.ddd.admission.formation_generale.domain.model.enums import ( ChoixStatutPropositionGenerale, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( OngletsChecklist as OngletsChecklistGenerale, ) from admission.tests.factories import DoctorateAdmissionFactory from admission.tests.factories.admission_viewer import AdmissionViewerFactory -from admission.tests.factories.continuing_education import ContinuingEducationAdmissionFactory +from admission.tests.factories.continuing_education import ( + ContinuingEducationAdmissionFactory, +) from admission.tests.factories.form_item import ( - MessageAdmissionFormItemFactory, - TextAdmissionFormItemFactory, - DocumentAdmissionFormItemFactory, + AdmissionFormItemInstantiationFactory, CheckboxSelectionAdmissionFormItemFactory, + DocumentAdmissionFormItemFactory, + MessageAdmissionFormItemFactory, RadioButtonSelectionAdmissionFormItemFactory, - AdmissionFormItemInstantiationFactory, + TextAdmissionFormItemFactory, ) from admission.tests.factories.general_education import GeneralEducationAdmissionFactory from admission.tests.factories.roles import SicManagementRoleFactory -from admission.tests.factories.scholarship import ( - InternationalScholarshipFactory, - DoubleDegreeScholarshipFactory, - ErasmusMundusScholarshipFactory, - DoctorateScholarshipFactory, -) from admission.tests.factories.supervision import PromoterFactory from admission.views.excel_exports import ( + SPECIFIC_QUESTION_SEPARATOR, + SPECIFIC_QUESTION_SEPARATOR_REPLACEMENT, AdmissionListExcelExportView, ContinuingAdmissionListExcelExportView, DoctorateAdmissionListExcelExportView, ) -from admission.views.excel_exports import ( - AdmissionListExcelExportView, - ContinuingAdmissionListExcelExportView, - SPECIFIC_QUESTION_SEPARATOR, - SPECIFIC_QUESTION_SEPARATOR_REPLACEMENT, -) from base.models.enums.education_group_types import TrainingType from base.models.enums.entity_type import EntityType from base.tests import QueriesAssertionsMixin @@ -109,6 +117,12 @@ from infrastructure.messages_bus import message_bus_instance from program_management.models.education_group_version import EducationGroupVersion from reference.tests.factories.country import CountryFactory +from reference.tests.factories.scholarship import ( + DoctorateScholarshipFactory, + DoubleDegreeScholarshipFactory, + ErasmusMundusScholarshipFactory, + InternationalScholarshipFactory, +) class UnfrozenDTO: @@ -292,9 +306,9 @@ def setUpTestData(cls): est_premiere_annee=False, poursuite_de_cycle=cls.admission.cycle_pursuit, annee_formation=cls.admission.training.academic_year.year, - annee_calculee=cls.admission.determined_academic_year.year - if cls.admission.determined_academic_year - else None, + annee_calculee=( + cls.admission.determined_academic_year.year if cls.admission.determined_academic_year else None + ), adresse_email_candidat=cls.admission.candidate.private_email, reponses_questions_specifiques={ cls.text_form_item_uuid: 'Answer 1', diff --git a/utils.py b/utils.py index 8f626a65d..cc8b2ab8e 100644 --- a/utils.py +++ b/utils.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,7 +28,7 @@ import uuid from collections import defaultdict from contextlib import suppress -from typing import Dict, Union, Iterable, List +from typing import Dict, Iterable, List, Union import weasyprint from django.conf import settings @@ -36,35 +36,46 @@ from django.contrib.auth.models import User from django.core.cache import cache from django.db import models -from django.db.models import QuerySet, F +from django.db.models import F, QuerySet from django.shortcuts import resolve_url from django.utils import timezone -from django.utils.translation import pgettext, override, get_language, gettext +from django.utils.translation import get_language, gettext, override, pgettext from django_htmx.http import trigger_client_event from rest_framework.generics import get_object_or_404 from admission.auth.roles.central_manager import CentralManager -from admission.auth.roles.program_manager import ProgramManager as AdmissionProgramManager -from admission.auth.roles.sic_management import SicManagement -from admission.constants import CONTEXT_CONTINUING, CONTEXT_GENERAL, CONTEXT_DOCTORATE -from admission.models import ( - ContinuingEducationAdmission, - DoctorateAdmission, - GeneralEducationAdmission, - Scholarship, +from admission.auth.roles.program_manager import ( + ProgramManager as AdmissionProgramManager, ) +from admission.auth.roles.sic_management import SicManagement +from admission.constants import CONTEXT_CONTINUING, CONTEXT_DOCTORATE, CONTEXT_GENERAL from admission.ddd.admission.doctorat.preparation.domain.validator.exceptions import ( AnneesCurriculumNonSpecifieesException, ) -from admission.ddd.admission.doctorat.preparation.dtos.curriculum import CurriculumAdmissionDTO +from admission.ddd.admission.doctorat.preparation.dtos.curriculum import ( + CurriculumAdmissionDTO, +) from admission.ddd.admission.doctorat.validation.domain.model.enums import ChoixGenre -from admission.ddd.admission.domain.model.enums.condition_acces import TypeTitreAccesSelectionnable -from admission.ddd.admission.dtos.etudes_secondaires import EtudesSecondairesAdmissionDTO -from admission.ddd.admission.dtos.titre_acces_selectionnable import TitreAccesSelectionnableDTO -from admission.ddd.admission.formation_generale.commands import VerifierCurriculumApresSoumissionQuery +from admission.ddd.admission.domain.model.enums.condition_acces import ( + TypeTitreAccesSelectionnable, +) +from admission.ddd.admission.dtos.etudes_secondaires import ( + EtudesSecondairesAdmissionDTO, +) +from admission.ddd.admission.dtos.titre_acces_selectionnable import ( + TitreAccesSelectionnableDTO, +) +from admission.ddd.admission.formation_generale.commands import ( + VerifierCurriculumApresSoumissionQuery, +) from admission.infrastructure.admission.domain.service.annee_inscription_formation import ( ADMISSION_CONTEXT_BY_OSIS_EDUCATION_TYPE, ) +from admission.models import ( + ContinuingEducationAdmission, + DoctorateAdmission, + GeneralEducationAdmission, +) from backoffice.settings.rest_framework.exception_handler import get_error_data from base.auth.roles.program_manager import ProgramManager from base.ddd.utils.business_validator import MultipleBusinessExceptions @@ -78,19 +89,22 @@ from base.utils.utils import format_academic_year from ddd.logic.formation_catalogue.commands import GetSigleFormationParenteQuery from ddd.logic.shared_kernel.profil.dtos.etudes_secondaires import ( + AlternativeSecondairesDTO, DiplomeBelgeEtudesSecondairesDTO, DiplomeEtrangerEtudesSecondairesDTO, - AlternativeSecondairesDTO, ) from ddd.logic.shared_kernel.profil.dtos.parcours_externe import ( ExperienceAcademiqueDTO, ExperienceNonAcademiqueDTO, ) -from ddd.logic.shared_kernel.profil.dtos.parcours_interne import ExperienceParcoursInterneDTO +from ddd.logic.shared_kernel.profil.dtos.parcours_interne import ( + ExperienceParcoursInterneDTO, +) from osis_common.ddd.interface import BusinessException, QueryRequest from program_management.ddd.domain.exception import ProgramTreeNotFoundException from reference.models.country import Country from reference.models.language import Language +from reference.models.scholarship import Scholarship def get_cached_admission_perm_obj(admission_uuid): @@ -303,10 +317,12 @@ def access_title_country(selectable_access_titles: Iterable[TitreAccesSelectionn def get_training_url(training_type, training_acronym, partial_training_acronym, suffix): # Circular import otherwise + from admission.constants import ( + CONTEXT_CONTINUING, + CONTEXT_DOCTORATE, + CONTEXT_GENERAL, + ) from infrastructure.messages_bus import message_bus_instance - from admission.constants import CONTEXT_CONTINUING - from admission.constants import CONTEXT_GENERAL - from admission.constants import CONTEXT_DOCTORATE if training_type == TrainingType.FORMATION_PHD.name: return ( @@ -423,9 +439,11 @@ def get_access_titles_names( # Curriculum experiences if isinstance(experience, ExperienceAcademiqueDTO): experience_name = '{title} ({year}) - {institute}'.format( - title=f'{experience.nom_formation} ({experience.nom_formation_equivalente_communaute_fr})' - if experience.nom_formation_equivalente_communaute_fr - else experience.nom_formation, + title=( + f'{experience.nom_formation} ({experience.nom_formation_equivalente_communaute_fr})' + if experience.nom_formation_equivalente_communaute_fr + else experience.nom_formation + ), year=format_academic_year(access_title.annee), institute=experience.nom_institut, ) @@ -445,7 +463,11 @@ def copy_documents(objs): Create copies of the files of the specified objects and affect them to the specified objects. :param objs: The list of objects. """ - from osis_document.api.utils import get_several_remote_metadata, get_remote_tokens, documents_remote_duplicate + from osis_document.api.utils import ( + documents_remote_duplicate, + get_remote_tokens, + get_several_remote_metadata, + ) from osis_document.contrib import FileField from osis_document.utils import generate_filename diff --git a/views/autocomplete/scholarship.py b/views/autocomplete/scholarship.py index 1532ab905..ed7432c7a 100644 --- a/views/autocomplete/scholarship.py +++ b/views/autocomplete/scholarship.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,12 +28,12 @@ from django.db.models import Q from rules.contrib.views import LoginRequiredMixin +from reference.models.scholarship import Scholarship + __all__ = [ 'ScholarshipAutocomplete', ] -from admission.models import Scholarship - class ScholarshipAutocomplete(LoginRequiredMixin, autocomplete.Select2QuerySetView): def get_queryset(self): diff --git a/views/excel_exports.py b/views/excel_exports.py index 2e95e04ac..d0914c4a3 100644 --- a/views/excel_exports.py +++ b/views/excel_exports.py @@ -6,7 +6,7 @@ # The core business involves the administration of students, teachers, # courses, programs and so on. # -# Copyright (C) 2015-2024 Université catholique de Louvain (http://www.uclouvain.be) +# Copyright (C) 2015-2025 Université catholique de Louvain (http://www.uclouvain.be) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -38,50 +38,71 @@ from django.utils.functional import cached_property from django.utils.html import format_html from django.utils.text import slugify -from django.utils.translation import gettext as _, gettext_lazy, pgettext, get_language +from django.utils.translation import get_language +from django.utils.translation import gettext as _ +from django.utils.translation import gettext_lazy, pgettext from django.views import View from osis_async.models import AsyncTask -from osis_export.contrib.export_mixins import ExportMixin, ExcelFileExportMixin +from osis_export.contrib.export_mixins import ExcelFileExportMixin, ExportMixin from osis_export.models import Export from osis_export.models.enums.types import ExportTypes -from admission.ddd.admission.enums.liste import TardiveModificationReorientationFiltre -from admission.models import Scholarship, AdmissionFormItem from admission.ddd.admission.commands import ListerToutesDemandesQuery -from admission.ddd.admission.doctorat.preparation.commands import ListerDemandesQuery as ListerDemandesDoctoralesQuery +from admission.ddd.admission.doctorat.preparation.commands import ( + ListerDemandesQuery as ListerDemandesDoctoralesQuery, +) from admission.ddd.admission.doctorat.preparation.domain.model.enums import ( + TOUS_CHOIX_COMMISSION_PROXIMITE, ChoixStatutPropositionDoctorale, ChoixTypeAdmission, - TOUS_CHOIX_COMMISSION_PROXIMITE, ChoixTypeFinancement, ) +from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( + OngletsChecklist as OngletsChecklistDoctorale, +) +from admission.ddd.admission.doctorat.preparation.domain.model.statut_checklist import ( + ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT as ORGANISATION_ONGLETS_CHECKLIST_DOCTORALE_PAR_STATUT, +) from admission.ddd.admission.doctorat.preparation.dtos.liste import DemandeRechercheDTO -from admission.ddd.admission.dtos.liste import DemandeRechercheDTO as TouteDemandeRechercheDTO +from admission.ddd.admission.dtos.liste import ( + DemandeRechercheDTO as TouteDemandeRechercheDTO, +) from admission.ddd.admission.enums import TypeItemFormulaire from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist +from admission.ddd.admission.enums.liste import TardiveModificationReorientationFiltre from admission.ddd.admission.enums.statut import CHOIX_STATUT_TOUTE_PROPOSITION_DICT from admission.ddd.admission.enums.type_demande import TypeDemande -from admission.ddd.admission.formation_continue.commands import ListerDemandesQuery as ListerDemandesContinuesQuery -from admission.ddd.admission.formation_continue.domain.model.enums import ChoixStatutPropositionContinue, ChoixEdition -from admission.ddd.admission.formation_continue.dtos.liste import DemandeRechercheDTO as DemandeContinueRechercheDTO -from admission.ddd.admission.formation_generale.domain.model.enums import OngletsChecklist -from admission.ddd.admission.formation_generale.domain.model.statut_checklist import ( - ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT as ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT_GENERALE, +from admission.ddd.admission.formation_continue.commands import ( + ListerDemandesQuery as ListerDemandesContinuesQuery, +) +from admission.ddd.admission.formation_continue.domain.model.enums import ( + ChoixEdition, + ChoixStatutPropositionContinue, +) +from admission.ddd.admission.formation_continue.domain.model.enums import ( + OngletsChecklist as OngletsChecklistContinue, ) from admission.ddd.admission.formation_continue.domain.model.statut_checklist import ( ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT as ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT_CONTINUE, ) -from admission.ddd.admission.formation_continue.domain.model.enums import OngletsChecklist as OngletsChecklistContinue -from admission.ddd.admission.doctorat.preparation.domain.model.statut_checklist import ( - ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT as ORGANISATION_ONGLETS_CHECKLIST_DOCTORALE_PAR_STATUT, +from admission.ddd.admission.formation_continue.dtos.liste import ( + DemandeRechercheDTO as DemandeContinueRechercheDTO, ) -from admission.ddd.admission.formation_generale.domain.model.enums import OngletsChecklist as OngletsChecklistGenerale -from admission.ddd.admission.doctorat.preparation.domain.model.enums.checklist import ( - OngletsChecklist as OngletsChecklistDoctorale, +from admission.ddd.admission.formation_generale.domain.model.enums import ( + OngletsChecklist, +) +from admission.ddd.admission.formation_generale.domain.model.enums import ( + OngletsChecklist as OngletsChecklistGenerale, +) +from admission.ddd.admission.formation_generale.domain.model.statut_checklist import ( + ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT as ORGANISATION_ONGLETS_CHECKLIST_PAR_STATUT_GENERALE, +) +from admission.forms.admission.filter import ( + AllAdmissionsFilterForm, + ContinuingAdmissionsFilterForm, ) -from admission.forms.admission.filter import AllAdmissionsFilterForm, ContinuingAdmissionsFilterForm -from admission.ddd.admission.enums.checklist import ModeFiltrageChecklist from admission.forms.doctorate.cdd.filter import DoctorateListFilterForm +from admission.models import AdmissionFormItem from admission.templatetags.admission import admission_status from admission.utils import add_messages_into_htmx_response from base.models.campus import Campus @@ -96,6 +117,7 @@ ] from reference.models.country import Country +from reference.models.scholarship import Scholarship FULL_DATE_FORMAT = '%Y/%m/%d, %H:%M:%S' SHORT_DATE_FORMAT = '%Y/%m/%d' @@ -165,9 +187,7 @@ def get_export_objects(self, **kwargs): def get_row_data_specific_questions_answers( self, - proposition_dto: Union[ - TouteDemandeRechercheDTO, - ], + proposition_dto: Union[TouteDemandeRechercheDTO,], ): """ Get the answers of the specific questions of the proposition based on a list of configurations.