Redirect to dashboard if this isn't the first service

There's no need to show the tour again if the user has previously
created a service so just redirect to the dashboard instead.
This commit is contained in:
Andrew White
2016-04-28 16:44:12 +01:00
parent 72c1ecc9cb
commit 7812b1cef5
3 changed files with 49 additions and 7 deletions

View File

@@ -43,7 +43,12 @@ def add_service():
user_id=session['user_id'],
email_from=email_from)
session['service_id'] = service_id
return redirect(url_for('main.tour', page=1))
services = service_api_client.get_services({'user_id': session['user_id']}).get('data', [])
if (len(services) > 1):
return redirect(url_for('main.service_dashboard', service_id=service_id))
else:
return redirect(url_for('main.tour', page=1))
else:
return render_template(
'views/add-service.html',