You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PPHA-593: separate quit smoking page from periods you stopped smoking (#427)
# What is the change?
Create a separate page in the former smoker journey so users can enter
when they quit
# Why are we making this change?
So that users can differentiate between when they quite and periods they
stopped smoking. This allows clarity and stops the user having to
calculate the total years stopped themselves
---------
Co-authored-by: Jamie Falcus <50366804+jamiefalcus@users.noreply.github.com>
"invalid": "Enter your age when you started smoking",
22
22
"zero_entered":"The age you started smoking must be between 1 and your current age",
23
23
"age_started_smoking_greater_than_current_age":"The age you started smoking must be the same as, or less than your current age",
24
-
"no_date_of_birth" : format_html("<a href=\"{}\">Provide your date of birth</a> before answering this question", reverse_lazy("questions:date_of_birth"))
24
+
"no_date_of_birth" : format_html("<a href=\"{}\">Provide your date of birth</a> before answering age when you started smoking", reverse_lazy("questions:date_of_birth"))
"no_when_you_quit_smoking": format_html("<a href=\"{}\">Provide when you quit smoking</a> before answering the total number of years you stopped smoking", reverse_lazy("questions:when_you_quit_smoking"))
44
+
}
39
45
)
40
46
41
47
defclean_duration_years(self):
@@ -59,7 +65,7 @@ def label(self):
59
65
ifself.response_set().current_smoker():
60
66
return"Have you ever stopped smoking for periods of 1 year or longer?"
61
67
else:
62
-
return"Did you ever stop or quit smoking for periods of 1 year or longer?"
68
+
return"Before you quit smoking, did you ever stop for periods of 1 year or longer?"
63
69
64
70
65
71
deflabel_is_page_heading(self):
@@ -82,24 +88,27 @@ def stopped_or_quit(self):
82
88
else:
83
89
return"stopped or quit "
84
90
91
+
defsmoked_or_smoke(self):
92
+
ifself.response_set().former_smoker():
93
+
return"smoked"
94
+
else:
95
+
return"have been smoking"
85
96
86
97
defrequired_error_message(self):
87
98
returnf"Select if you ever {self.stopped_or_quit()}smoking for periods of 1 year or longer"
88
99
89
100
101
+
defduration_years_error_message(self):
102
+
returnf"The number of years you stopped smoking must be fewer than the total number of years you {self.smoked_or_smoke()}"
103
+
104
+
90
105
defduration_years_required_error_message(self):
91
106
returnf"Enter the total number of years you {self.stopped_or_quit()}smoking"
92
107
93
108
94
109
defduration_years_label(self):
95
-
ifself.response_set().current_smoker():
96
-
return"Enter the total number of years you stopped smoking"
97
-
else:
98
-
return"Roughly how many years did you stop or quit smoking in total?"
110
+
return"Enter the total number of years you stopped smoking"
99
111
100
112
101
113
defduration_years_hint(self):
102
-
ifself.response_set().current_smoker():
103
-
return"Give an estimate if you are not sure"
104
-
else:
105
-
return"Add together the periods when you stopped smoking and the number of years since you quit. Give an estimate if you are not sure."
from ..models.when_you_quit_smoking_responseimportWhenYouQuitSmokingResponse
7
+
8
+
classWhenYouQuitSmokingForm(forms.ModelForm):
9
+
classMeta:
10
+
model=WhenYouQuitSmokingResponse
11
+
fields= ["value"]
12
+
13
+
def__init__(self, *args, **kwargs):
14
+
super().__init__(*args, **kwargs)
15
+
16
+
self.fields["value"] =IntegerField(
17
+
label="How old were you when you quit smoking?",
18
+
label_classes="nhsuk-label--m",
19
+
classes="nhsuk-input--width-2",
20
+
hint="Give an estimate if you are not sure",
21
+
prefix="Age",
22
+
error_messages={
23
+
"required": "Enter your age when you quit smoking",
24
+
"invalid": "Enter your age when you quit smoking",
25
+
"min_value":"The age you quit smoking must be between 1 and your current age",
26
+
"age_when_quit_smoking_greater_than_age_started":"The age you quit smoking cannot be lower than the age you started smoking",
27
+
"age_when_quit_smoking_greater_than_current_age" : "The age you quit smoking must be the same as, or less than, your current age",
28
+
"no_date_of_birth" : format_html("<a href=\"{}\">Provide your date of birth</a> before answering when you quit smoking", reverse_lazy("questions:date_of_birth"))
0 commit comments