Skip to content

Commit 1b58815

Browse files
committed
Use correct date comparison for age elligibility check
1 parent c0d116d commit 1b58815

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

lung_cancer_screening/questions/tests/unit/views/test_have_you_ever_smoked.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ def test_post_redirects_if_the_particpant_does_not_exist(self):
4949

5050
self.assertRedirects(response, reverse("questions:start"))
5151

52-
def test_post_stores_a_valid_date_response_for_the_participant(self):
52+
def test_post_stores_a_valid_boolean_response_for_the_participant(self):
5353
self.client.post(
5454
reverse("questions:have_you_ever_smoked"),
5555
self.valid_params
5656
)
5757

58-
date_response = BooleanResponse.objects.first()
59-
self.assertEqual(date_response.value, self.valid_params["value"])
60-
self.assertEqual(date_response.participant, self.participant)
61-
self.assertEqual(date_response.question, "Have you ever smoked?")
58+
boolean_response = BooleanResponse.objects.first()
59+
self.assertEqual(boolean_response.value, self.valid_params["value"])
60+
self.assertEqual(boolean_response.participant, self.participant)
61+
self.assertEqual(boolean_response.question, "Have you ever smoked?")
6262

6363
def test_post_sets_the_participant_id_in_session(self):
6464
self.client.post(

lung_cancer_screening/questions/views/date_of_birth.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def date_of_birth(request):
2626
fifty_five_years_ago = date.today() - relativedelta(years=55)
2727
seventy_five_years_ago = date.today() - relativedelta(years=75)
2828

29-
if value in (fifty_five_years_ago, seventy_five_years_ago):
29+
if (seventy_five_years_ago < value <= fifty_five_years_ago):
3030
DateResponse.objects.create(
3131
participant=participant,
3232
value=value,

0 commit comments

Comments
 (0)