Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] [technical/OS-1306 => DEV] [Ecran Fusion] Correction affichage sur les études secondaires candidat/personne connue #2226

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 14 additions & 13 deletions templates/admission/previous_experience.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,14 @@ <h6>{% trans 'Secondary school or alternative' %}</h6>
<input type="checkbox"
name="educational"
value="{{ experience.uuid }}"
{% if experience.source == 'CANDIDAT' %}
disabled
{% if experience.is_checked %}
checked
disabled
{% endif %}
{% if experience.source == 'CANDIDAT' %}
title="{% trans 'Will be automatically retrieved from candidate' %}"
{% else %}
disabled
{% endif %}/>
{% endif %}
/>
</td>
<td>{{ experience.annees|display_as_academic_year }}</td>
<td>{{ experience.nom_formation|default_if_none_or_empty:'-' }}</td>
Expand All @@ -69,7 +70,7 @@ <h6>{% trans 'Secondary school or alternative' %}</h6>
</td>
</tr>
{% empty %}
<tr>
<tr class="text-center">
<td colspan="5">
<strong>{% trans 'No data' context 'admission' %}</strong>
</td>
Expand Down Expand Up @@ -107,11 +108,11 @@ <h6>{% trans 'Academic course' %}</h6>
<td>{{ experience.nom_formation|default_if_none_or_empty:'-' }}</td>
<td>{{ experience.nom_institut|default_if_none_or_empty:'-' }}</td>
<td>
{% if experience.uuid in mergeable_experiences_uuids %}
<div class="badge badge-warning">Connue UCL</div>
{% else %}
{% if experience.source == 'CANDIDAT' %}
<div class="badge badge-info">Candidat</div>
{% endif %}
{% else %}
<div class="badge badge-warning">Connue UCL</div>
{% endif %}
</td>
</tr>
{% empty %}
Expand Down Expand Up @@ -160,10 +161,10 @@ <h6>{% trans 'Non-academic activity' %}</h6>
<td>{{ experience.fonction|default_if_none_or_empty:'-' }}</td>
<td>{{ experience.employeur|default_if_none_or_empty:'-' }}</td>
<td>
{% if experience.uuid in mergeable_experiences_uuids %}
<div class="badge badge-warning">Connue UCL</div>
{% else %}
{% if experience.source == 'CANDIDAT' %}
<div class="badge badge-info">Candidat</div>
{% else %}
<div class="badge badge-warning">Connue UCL</div>
{% endif %}
</td>
</tr>
Expand Down
78 changes: 62 additions & 16 deletions views/services/previous_experience.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,22 @@ def get_context_data(self, **kwargs):
return context

def get_secondary_school_or_alternative_experiences(self):
secondary_school_or_alternative_experiences = [
SimpleNamespace(
uuid=self.etudes_secondaires_candidat.uuid,
annees=self.etudes_secondaires_candidat.annee_diplome_etudes_secondaires,
nom_formation=self._get_nom_formation_etude_secondaire(self.etudes_secondaires_candidat),
nom_institut=self._get_nom_institut_etude_secondaire(self.etudes_secondaires_candidat),
est_experience_belge=isinstance(
self.etudes_secondaires_candidat.experience, DiplomeBelgeEtudesSecondairesDTO
),
source='CANDIDAT',
secondary_school_or_alternative_experiences = []
if self.etudes_secondaires_candidat.experience is not None:
secondary_school_or_alternative_experiences.append(
SimpleNamespace(
uuid=self.etudes_secondaires_candidat.uuid,
annees=self.etudes_secondaires_candidat.annee_diplome_etudes_secondaires,
nom_formation=self._get_nom_formation_etude_secondaire(self.etudes_secondaires_candidat),
nom_institut=self._get_nom_institut_etude_secondaire(self.etudes_secondaires_candidat),
est_experience_belge=isinstance(
self.etudes_secondaires_candidat.experience, DiplomeBelgeEtudesSecondairesDTO
),
source='CANDIDAT',
is_checked=True,
)
)
]
if self.etudes_secondaires_personne_connue:
if self.etudes_secondaires_personne_connue and self.etudes_secondaires_personne_connue.experience is not None:
secondary_school_or_alternative_experiences.append(
SimpleNamespace(
uuid=self.etudes_secondaires_personne_connue.uuid,
Expand All @@ -154,6 +157,7 @@ def get_secondary_school_or_alternative_experiences(self):
self.etudes_secondaires_candidat.experience, DiplomeBelgeEtudesSecondairesDTO
),
source='PERSONNE_CONNUE',
is_checked=len(secondary_school_or_alternative_experiences) == 0,
)
)
return secondary_school_or_alternative_experiences
Expand All @@ -180,15 +184,57 @@ def _get_nom_institut_etude_secondaire(self, etude_secondaire: EtudesSecondaires
return getattr(etude_secondaire.experience, 'pays_nom', '')

def get_professional_experiences(self):
professional_experiences = self.curriculum_candidat.experiences_non_academiques
professional_experiences = [
SimpleNamespace(
uuid=experience_non_academique.uuid,
date_debut=experience_non_academique.date_debut,
date_fin=experience_non_academique.date_fin,
type=experience_non_academique.type,
secteur=experience_non_academique.secteur,
autre_activite=experience_non_academique.autre_activite,
fonction=experience_non_academique.fonction,
employeur=experience_non_academique.employeur,
source='CANDIDAT',
) for experience_non_academique in self.curriculum_candidat.experiences_non_academiques
]
if self.curriculum_personne_connue:
professional_experiences += self.curriculum_personne_connue.experiences_non_academiques
professional_experiences += [
SimpleNamespace(
uuid=experience_non_academique.uuid,
date_debut=experience_non_academique.date_debut,
date_fin=experience_non_academique.date_fin,
type=experience_non_academique.type,
secteur=experience_non_academique.secteur,
autre_activite=experience_non_academique.autre_activite,
fonction=experience_non_academique.fonction,
employeur=experience_non_academique.employeur,
source='PERSONNE_CONNUE',
) for experience_non_academique in self.curriculum_personne_connue.experiences_non_academiques
]
return sorted(professional_experiences, key=lambda exp: (exp.date_debut, exp.date_fin), reverse=True)

def get_educational_experiences(self):
educational_experiences = self.curriculum_candidat.experiences_academiques
educational_experiences = [
SimpleNamespace(
uuid=educational_experiences.uuid,
titre_formate=educational_experiences.titre_formate,
annees=educational_experiences.annees,
nom_formation=educational_experiences.nom_formation,
nom_institut=educational_experiences.nom_institut,
source='CANDIDAT',
) for educational_experiences in self.curriculum_candidat.experiences_academiques
]
if self.curriculum_personne_connue:
educational_experiences += self.curriculum_personne_connue.experiences_academiques
educational_experiences += [
SimpleNamespace(
uuid=educational_experiences.uuid,
titre_formate=educational_experiences.titre_formate,
annees=educational_experiences.annees,
nom_formation=educational_experiences.nom_formation,
nom_institut=educational_experiences.nom_institut,
source='PERSONNE_CONNUE',
) for educational_experiences in self.curriculum_personne_connue.experiences_academiques
]
return sorted(educational_experiences, key=lambda exp: exp.titre_formate, reverse=True)

def get_mergeable_experiences_uuids(self):
Expand Down