Skip to content

Commit b972012

Browse files
committed
PPHA-262: Resolve linting errors
1 parent bd7722e commit b972012

File tree

7 files changed

+37
-48
lines changed

7 files changed

+37
-48
lines changed

lung_cancer_screening/core/form_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ def widget_attrs(self, widget):
206206
attrs.pop("step", None)
207207

208208
return attrs
209-
209+
210210
class DecimalField(forms.DecimalField):
211211
def __init__(
212212
self,

lung_cancer_screening/core/jinja2/forms/input.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@
3131
{% set input_params = dict(input_params, **error_params) %}
3232
{% endif %}
3333

34-
{{ input(input_params) }}
34+
{{ input(input_params) }}

lung_cancer_screening/core/tests/acceptance/helpers/user_interaction_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def fill_in_and_submit_height_imperial(page, feet, inches):
3636
page.get_by_label("Feet").fill(str(feet))
3737
page.get_by_label("Inches").fill(str(inches))
3838

39-
page.click("text=Continue")
39+
page.click("text=Continue")

lung_cancer_screening/questions/forms/imperial_height_form.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def __init__(self, *args, **kwargs):
1212
self.instance.participant = self.participant
1313

1414
self.fields["height_feet"] = DecimalField(
15-
label="Feet",
16-
classes="nhsuk-input--width-4",
15+
label="Feet",
16+
classes="nhsuk-input--width-4",
1717
)
18-
18+
1919
self.fields["height_inches"] = DecimalField(
20-
label="Inches",
21-
classes="nhsuk-input--width-4",
20+
label="Inches",
21+
classes="nhsuk-input--width-4",
2222
)
2323

2424
def clean_height(self):
@@ -27,4 +27,4 @@ def clean_height(self):
2727

2828
class Meta:
2929
model = ResponseSet
30-
fields = ['height']
30+
fields = ['height']

lung_cancer_screening/questions/forms/metric_height_form.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,13 @@ def __init__(self, *args, **kwargs):
1212
self.instance.participant = self.participant
1313

1414
self.fields["height"] = DecimalField(
15-
label="Centimetres",
16-
classes="nhsuk-input--width-4",
15+
label="Centimetres",
16+
classes="nhsuk-input--width-4",
1717
)
1818

1919
def clean_height(self):
20-
data = self.cleaned_data['height']
21-
return data*10
20+
return self.cleaned_data['height'] * 10
2221

2322
class Meta:
2423
model = ResponseSet
25-
fields = ['height']
24+
fields = ['height']

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,3 @@ def test_post_responds_with_422_if_the_resource_is_invalid(self):
7474
)
7575

7676
self.assertEqual(response.status_code, 422)
77-
78-
79-
# If nothing is entered - Enter your height
80-
# User enters a height that is outside the accepted range (cms) - Height must be between 139.7cm and 243.8 cm
81-
# User enters a height that is outside the accepted range (feet and inches) - Height must be between 4 feet 7 inches and 8 feet
82-
# User enters a reading for feet that is outside the accepted range - Feet must be between 4 and 8
83-
# User enters a reading for inches that is outside the accepted range - Inches must be between 0 and 11
84-
# User enters a reading for feet using a decimal point - Feet must be in whole numbers
85-
# User enters a reading for inches using a decimal point - I
Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
from django.shortcuts import render, redirect
2-
from django.core.exceptions import ValidationError
32

43
from lung_cancer_screening.questions.forms.metric_height_form import MetricHeightForm
5-
from lung_cancer_screening.questions.models import participant
64

75
from .decorators.participant_decorators import require_participant
86

97
@require_participant
10-
def height(request):
11-
if request.method == "POST":
12-
form = MetricHeightForm(
13-
instance = request.participant.responseset_set.last(),
14-
data=request.POST,
15-
participant=request.participant
16-
)
8+
def height(request):
9+
if request.method == "POST":
10+
form = MetricHeightForm(
11+
instance = request.participant.responseset_set.last(),
12+
data=request.POST,
13+
participant=request.participant
14+
)
1715

18-
if form.is_valid() :
19-
form.save()
16+
if form.is_valid():
17+
form.save()
2018

21-
return redirect("questions:responses")
22-
else :
23-
return render(
24-
request,
25-
"height.jinja",
26-
{ "form" : form },
27-
status=422
28-
)
29-
unit = request.GET.get('unit')
30-
return render(
19+
return redirect("questions:responses")
20+
else :
21+
return render(
22+
request,
23+
"height.jinja",
24+
{ "form": form },
25+
status=422
26+
)
27+
28+
unit = request.GET.get('unit')
29+
return render(
3130
request,
3231
"height.jinja",
33-
{
34-
"form" : MetricHeightForm(participant=request.participant),
35-
"unit" : unit,
36-
"switch_to_unit" : "metric" if unit == "imperial" else "imperial"
32+
{
33+
"form": MetricHeightForm(participant=request.participant),
34+
"unit": unit,
35+
"switch_to_unit": "metric" if unit == "imperial" else "imperial"
3736
}
3837
)

0 commit comments

Comments
 (0)