Skip to content

Commit

Permalink
www: Fix displaying an accepted geiq job application without diagnosis
Browse files Browse the repository at this point in the history
  • Loading branch information
tonial committed Jan 10, 2025
1 parent 22cbf2f commit d3c6cec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions itou/www/apply/views/process_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def check_waiting_period(job_application):
def _get_geiq_eligibility_diagnosis(job_application, only_prescriber):
# Return the job_application diagnosis if it's accepted
if job_application.state.is_accepted:
# but not if the viewer is a prescriber and the diangosis was made by the company
if only_prescriber and job_application.geiq_eligibility_diagnosis.author_geiq:
# or None if the viewer is a prescriber and the diangosis was made by the company
# NB. the job application may not have a geiq diagnosis
if only_prescriber and getattr(job_application.geiq_eligibility_diagnosis, "author_geiq", None):
return None
return job_application.geiq_eligibility_diagnosis
return GEIQEligibilityDiagnosis.objects.diagnoses_for(
Expand Down
10 changes: 10 additions & 0 deletions tests/www/apply/test_geiq.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ def test_with_expired_diagnosis_no_allowance(self, client):
assertNotContains(response, self.EXPIRED_DIAGNOSIS_EXPLANATION)
assertNotContains(response, self.CONFIRMATION_MODAL)

def test_accepted_without_diagnosis(self, client):
job_application = JobApplicationFactory(
state=JobApplicationState.ACCEPTED,
to_company__kind=CompanyKind.GEIQ,
eligibility_diagnosis=None,
)

response = self.get_response(client, job_application, job_application.sender)
assert response.status_code == 200


def test_get_geiq_eligibility_diagnosis(subtests):
expired_prescriber_diagnosis = GEIQEligibilityDiagnosisFactory(
Expand Down

0 comments on commit d3c6cec

Please sign in to comment.