Skip to content

Commit af9f3c3

Browse files
author
Mike Taylor
committed
Issue #432 - Derive bug title summary from selected radio choice
1 parent e6de093 commit af9f3c3

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

webcompat/form.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
problem_choices = [
2626
(u'detection_bug', u'Desktop site instead of mobile site'),
2727
(u'mobile_site_bug', u'Mobile site is not usable'),
28-
(u'video_bug', u'Video does\'nt play'),
28+
(u'video_bug', u'Video doesn\'t play'),
2929
(u'layout_bug', u'Layout is messed up'),
3030
(u'text_bug', u'Text is not visible'),
3131
(u'unknown_bug', u'Somethign else - I\'ll add details below')
@@ -64,6 +64,14 @@ def get_problem(category):
6464
return u'Unknown'
6565

6666

67+
def get_problem_summary(category):
68+
'''Allows us to special case the "Other" radio choice summary.'''
69+
if category == 'unknown_bug':
70+
return u'see bug description'
71+
else:
72+
return get_problem(category).lower()
73+
74+
6775
def wrap_label(label):
6876
'''Helper method to wrap a label and its type in an HTML comment.
6977
@@ -138,10 +146,11 @@ def build_formdata(form_object):
138146
normalized_url = normalize_url(url)
139147
# Domain extraction
140148
domain = domain_name(normalized_url)
149+
problem_summary = get_problem_summary(form_object.get('problem_category'))
141150
if domain:
142-
summary = '{0} - {1}'.format(domain, form_object.get('summary'))
151+
summary = '{0} - {1}'.format(domain, problem_summary)
143152
else:
144-
summary = '{0}'.format(form_object.get('summary'))
153+
summary = '{0} - {1}'.format(normalized_url, problem_summary)
145154
# Preparing the body
146155
body = u'''{browser_label}{ua_label}
147156
**URL**: {url}
@@ -160,6 +169,6 @@ def build_formdata(form_object):
160169
description=form_object.get('description')
161170
)
162171
result = {}
163-
result['title'] = 'TODO: Get the title from the selected choice'
172+
result['title'] = summary
164173
result['body'] = body
165174
return result

0 commit comments

Comments
 (0)