Merge pull request #2268 from alphagov/request-to-go-live-better-data

Make the data we get from the go live requests more useful
This commit is contained in:
Chris Hill-Scott
2018-09-04 16:25:59 +01:00
committed by GitHub
6 changed files with 99 additions and 88 deletions

View File

@@ -569,24 +569,26 @@ class Triage(StripWhitespaceForm):
class RequestToGoLiveForm(StripWhitespaceForm):
channel_email = BooleanField('Emails')
channel_sms = BooleanField('Text messages')
channel_letter = BooleanField('Letters')
start_date = StringField(
'When will you be ready to start sending messages?',
volume_email = StringField(
'How many emails do you expect to send in the next year?',
validators=[DataRequired(message='Cant be empty')]
)
start_volume = StringField(
'How many messages do you expect to send to start with?',
volume_sms = StringField(
'How many text messages do you expect to send in the next year?',
validators=[DataRequired(message='Cant be empty')]
)
peak_volume = StringField(
'Will the number of messages increase and when will that start?',
volume_letter = StringField(
'How many letters do you expect to send in the next year?',
validators=[DataRequired(message='Cant be empty')]
)
method_one_off = BooleanField('One at a time')
method_upload = BooleanField('Upload a spreadsheet of recipients')
method_api = BooleanField('Integrate with the GOV.UK Notify API')
research_consent = RadioField(
'Can we contact you when were doing user research?',
choices=[
('yes', 'Yes'),
('no', 'No'),
],
validators=[DataRequired()]
)
class ProviderForm(StripWhitespaceForm):

View File

@@ -1,3 +1,6 @@
from datetime import datetime
import pytz
from flask import (
abort,
current_app,
@@ -11,7 +14,6 @@ from flask import (
from flask_login import current_user, login_required
from notifications_python_client.errors import HTTPError
from notifications_utils.field import Field
from notifications_utils.formatters import formatted_list
from app import (
billing_api_client,
@@ -214,32 +216,42 @@ def submit_request_to_go_live(service_id):
zendesk_client.create_ticket(
subject='Request to go live - {}'.format(current_service.name),
message=(
'Service: {}\n'
'{}\n'
'Service: {service_name}\n'
'{service_dashboard}\n'
'\n---'
'\nOrganisation type: {}'
'\nAgreement signed: {}'
'\nChannel: {}\nStart date: {}\nStart volume: {}'
'\nPeak volume: {}'
'\nFeatures: {}'
'\nOrganisation type: {organisation_type}'
'\nAgreement signed: {agreement}'
'\nEmails in next year: {volume_email}'
'\nText messages in next year: {volume_sms}'
'\nLetters in next year: {volume_letter}'
'\nConsent to research: {research_consent}'
'\n'
'\n---'
'\n'
'{service_id}, '
'{organisation}, '
'{service_name}, '
'{user_name}, '
'{user_email}, '
'-, '
'{date}, '
'{volume_sms}, '
'{volume_email}, '
'{volume_letter}'
).format(
current_service.name,
url_for('main.service_dashboard', service_id=current_service.id, _external=True),
current_service.organisation_type,
AgreementInfo.from_current_user().as_human_readable,
formatted_list(filter(None, (
'email' if form.channel_email.data else None,
'text messages' if form.channel_sms.data else None,
'letters' if form.channel_letter.data else None,
)), before_each='', after_each=''),
form.start_date.data,
form.start_volume.data,
form.peak_volume.data,
formatted_list(filter(None, (
'one off' if form.method_one_off.data else None,
'file upload' if form.method_upload.data else None,
'API' if form.method_api.data else None,
)), before_each='', after_each='')
service_name=current_service.name,
service_dashboard=url_for('main.service_dashboard', service_id=current_service.id, _external=True),
organisation_type=str(current_service.organisation_type).title(),
agreement=AgreementInfo.from_current_user().as_human_readable,
volume_email=form.volume_email.data,
volume_sms=form.volume_sms.data,
volume_letter=form.volume_letter.data,
research_consent=form.research_consent.data.title(),
service_id=current_service.id,
organisation=AgreementInfo.from_current_user().owner,
user_name=current_user.name,
user_email=current_user.email_address,
date=datetime.now(tz=pytz.timezone('Europe/London')).strftime('%d/%m/%Y'),
),
ticket_type=zendesk_client.TYPE_QUESTION,
user_email=current_user.email_address,