Skip to content

Commit

Permalink
metabase.job_seekers: Export diagnosis' expiration date and its validity
Browse files Browse the repository at this point in the history
  • Loading branch information
rsebille committed Dec 23, 2024
1 parent 8728df1 commit 945d09e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions itou/metabase/tables/job_seekers.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,18 @@ def get_table():
"comment": "Date du dernier diagnostic",
"fn": lambda o: getattr(get_latest_diagnosis(o), "created_at", None),
},
{
"name": "date_expiration_diagnostic",
"type": "date",
"comment": "Date d'expiration du dernier diagnostic",
"fn": lambda o: getattr(get_latest_diagnosis(o), "expires_at", None),
},
{
"name": "diagnostic_valide",
"type": "boolean",
"comment": "Validité du dernier diagnostic au moment de l'import",
"fn": lambda o: getattr(get_latest_diagnosis(o), "is_valid", None),
},
{
"name": "id_auteur_diagnostic_prescripteur",
"type": "integer",
Expand Down
8 changes: 8 additions & 0 deletions tests/metabase/management/test_populate_metabase_emplois.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ def test_populate_job_seekers():
# - job_application / approval from ai stock
# - created by an employer
# - outside QPV
# - expired eligibility diagnosis
user_2 = JobSeekerFactory(
created_by=EmployerFactory(),
jobseeker_profile__nir="271049232724647",
Expand All @@ -165,6 +166,7 @@ def test_populate_job_seekers():
)
job_application_2 = JobApplicationFactory(
with_approval=True,
eligibility_diagnosis__expired=True,
approval__eligibility_diagnosis=None,
job_seeker=user_2,
approval__origin=Origin.AI_STOCK,
Expand Down Expand Up @@ -280,6 +282,8 @@ def test_populate_job_seekers():
None,
None,
None,
None,
None,
0,
timezone.localdate() - datetime.timedelta(days=1),
),
Expand All @@ -306,6 +310,8 @@ def test_populate_job_seekers():
1,
1,
job_application_2.eligibility_diagnosis.created_at.date(),
job_application_2.eligibility_diagnosis.expires_at,
0,
job_application_2.eligibility_diagnosis.author_prescriber_organization.id,
None,
"Prescripteur",
Expand Down Expand Up @@ -358,6 +364,8 @@ def test_populate_job_seekers():
2,
2,
job_application_3.eligibility_diagnosis.created_at.date(),
job_application_3.eligibility_diagnosis.expires_at,
1,
None,
job_application_3.eligibility_diagnosis.author_siae.id,
"Employeur",
Expand Down

0 comments on commit 945d09e

Please sign in to comment.