Skip to content

Commit

Permalink
Merge pull request #349 from cfpb/fix-feedback
Browse files Browse the repository at this point in the history
Pass the offer data explicitly to the feedback form
  • Loading branch information
willbarton committed May 17, 2019
2 parents 277ef0f + e36e5a1 commit 3f1ded0
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
1 change: 0 additions & 1 deletion paying_for_college/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

class FeedbackForm(forms.Form):
message = forms.CharField(widget=forms.Textarea)
referrer = forms.CharField(widget=forms.HiddenInput)


class EmailForm(forms.Form):
Expand Down
2 changes: 1 addition & 1 deletion paying_for_college/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ class Meta:
def parsed_url(self):
"""parses a disclosure URL and returns a field:value dict"""
data = {}
if not self.url or 'feedback' in self.url or '?' not in self.url:
if not self.url or '?' not in self.url:
return data
split_fields = self.url.replace(
'#info-right', '').split('?')[1].split('&')
Expand Down
1 change: 0 additions & 1 deletion paying_for_college/templates/feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ <h2>What do you think about this tool?</h2>
<form method="post" id="feedback-container">
<label for="id_message"><span class="demi">Enter your comments here</span></label>
{% csrf_token %}
<input type="hidden" name="referrer" value="{{ request.META.HTTP_REFERER }}">
<span class="pfc-feedback">{{ form.message }}</span>
<p><button>Submit your feedback</button></p>
</form>
Expand Down
2 changes: 1 addition & 1 deletion paying_for_college/templates/worksheet.html
Original file line number Diff line number Diff line change
Expand Up @@ -3306,7 +3306,7 @@ <h2 class="step_heading">
</div>
<a class="a-btn a-btn__full-on-xs"
title="Give feedback on this tool"
href="/{{url_root}}/understanding-your-financial-aid-offer/feedback"
href="/{{url_root}}/understanding-your-financial-aid-offer/feedback?{{request.GET.urlencode}}"
target="_blank" rel="noopener noreferrer"
data-qa='feedback-btn'
data-gtm_ignore="true">
Expand Down
7 changes: 5 additions & 2 deletions paying_for_college/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def create_feedback(self):
created=datetime.datetime.now(),
message='Thank you, FPO',
url=('www.cfpb.gov/paying-for-college2/'
'understanding-your-financial-aid-offer/offer/'
'understanding-your-financial-aid-offer/feedback/'
'?iped=451796&pid=2736'
'&oid=1234567890123456789012345678901234567890'
'&book=1832&gib=0&gpl=0&hous=4431&insi=3.36&insl=4339'
Expand Down Expand Up @@ -288,7 +288,10 @@ def test_feedback_unmet_cost(self):
self.assertEqual(feedback.unmet_cost, 8136)
feedback.url = feedback.url.replace('&book=1832', '&book=voodoo')
self.assertEqual(feedback.unmet_cost, 6304)
feedback.url = feedback.url.replace('offer', 'feedback')
feedback.url = feedback.url = (
'www.cfpb.gov/paying-for-college2/'
'understanding-your-financial-aid-offer/feedback/'
)
self.assertIs(feedback.unmet_cost, None)

def test_feedback_cost_error_valid_values(self):
Expand Down
2 changes: 1 addition & 1 deletion paying_for_college/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def post(self, request):
if form.is_valid():
feedback = Feedback(
message=form.cleaned_data['message'][:2000],
url=form.cleaned_data['referrer'].replace('#info-right', ''))
url=request.build_absolute_uri())
feedback.save()
return render(request, 'feedback_thanks.html', {
'base_template': BASE_TEMPLATE,
Expand Down

0 comments on commit 3f1ded0

Please sign in to comment.