14 days no survey for new users
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
from rowers.models import Workout, PowerTimeFitnessMetric, Rower, PaidPlan
|
from rowers.models import Workout, PowerTimeFitnessMetric, Rower, PaidPlan
|
||||||
import datetime
|
import datetime
|
||||||
@@ -111,7 +110,8 @@ class SurveyMiddleWare(object):
|
|||||||
nexturl = request.path
|
nexturl = request.path
|
||||||
if 'survey' in nexturl:
|
if 'survey' in nexturl:
|
||||||
nexturl = '/rowers/list-workouts'
|
nexturl = '/rowers/list-workouts'
|
||||||
if not r.surveydone:
|
mustseesurvey = request.user.date_joined <= timezone.now()-datetime.timedelta(days=14) and not r.surveydone
|
||||||
|
if mustseesurvey:
|
||||||
return redirect(
|
return redirect(
|
||||||
'/rowers/survey/?next=%s' % nexturl
|
'/rowers/survey/?next=%s' % nexturl
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ class NewUserRegistrationTest(TestCase):
|
|||||||
response = self.c.post('/rowers/register/', form_data, follow=True)
|
response = self.c.post('/rowers/register/', form_data, follow=True)
|
||||||
|
|
||||||
self.assertRedirects(response,
|
self.assertRedirects(response,
|
||||||
expected_url='/rowers/survey/?next=/rowers/list-workouts/',
|
expected_url='/rowers/me/gdpr-optin/?next=/rowers/list-workouts/',
|
||||||
status_code=302,target_status_code=200)
|
status_code=302,target_status_code=200)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
57
rowers/tests/testdata/course.kml
vendored
Normal file
57
rowers/tests/testdata/course.kml
vendored
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
<?xml version="1.0" ?>
|
||||||
|
<kml xmlns="http://www.opengis.net/kml/2.2" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gx="http://www.google.com/kml/ext/2.2" xmlns:kml="http://www.google.com/kml/ext/2.2">
|
||||||
|
<Document>
|
||||||
|
<name>Courses.kml</name>
|
||||||
|
<Folder>
|
||||||
|
<name>Courses</name>
|
||||||
|
<Folder>
|
||||||
|
<name>CrewNerd Examples - Uherské Hradiště</name>
|
||||||
|
<open>1</open>
|
||||||
|
<Placemark>
|
||||||
|
<name>Start</name>
|
||||||
|
<Polygon>
|
||||||
|
<tessellate>1</tessellate>
|
||||||
|
<outerBoundaryIs>
|
||||||
|
<LinearRing>
|
||||||
|
<coordinates>17.4893745389,49.109471228,0 17.4911067423,49.1094811918,0 17.4909527884,49.1103411557,0 17.4888918133,49.1102899098,0 17.4893745389,49.109471228,0 17.4893745389,49.109471228,0</coordinates>
|
||||||
|
</LinearRing>
|
||||||
|
</outerBoundaryIs>
|
||||||
|
</Polygon>
|
||||||
|
</Placemark>
|
||||||
|
<Placemark>
|
||||||
|
<name>Turn</name>
|
||||||
|
<Polygon>
|
||||||
|
<tessellate>1</tessellate>
|
||||||
|
<outerBoundaryIs>
|
||||||
|
<LinearRing>
|
||||||
|
<coordinates>17.4836181002,49.0979347215,0 17.489332427,49.0981702202,0 17.4888058511,49.1024117428,0 17.4836162032,49.1030885423,0 17.4836181002,49.0979347215,0 17.4836181002,49.0979347215,0</coordinates>
|
||||||
|
</LinearRing>
|
||||||
|
</outerBoundaryIs>
|
||||||
|
</Polygon>
|
||||||
|
</Placemark>
|
||||||
|
<Placemark>
|
||||||
|
<name>Turn</name>
|
||||||
|
<Polygon>
|
||||||
|
<tessellate>1</tessellate>
|
||||||
|
<outerBoundaryIs>
|
||||||
|
<LinearRing>
|
||||||
|
<coordinates>17.4928830266,49.0866607478,0 17.4973472737,49.0861776065,0 17.4994059869,49.0903340046,0 17.4942740099,49.0899098202,0 17.4928830266,49.0866607478,0 17.4928830266,49.0866607478,0</coordinates>
|
||||||
|
</LinearRing>
|
||||||
|
</outerBoundaryIs>
|
||||||
|
</Polygon>
|
||||||
|
</Placemark>
|
||||||
|
<Placemark>
|
||||||
|
<name>Finish</name>
|
||||||
|
<Polygon>
|
||||||
|
<tessellate>1</tessellate>
|
||||||
|
<outerBoundaryIs>
|
||||||
|
<LinearRing>
|
||||||
|
<coordinates>17.4627698339,49.0723911762,0 17.4630054316,49.071305244,0 17.4643666779,49.0712945663,0 17.4641649495,49.0724875988,0 17.4627698339,49.0723911762,0 17.4627698339,49.0723911762,0</coordinates>
|
||||||
|
</LinearRing>
|
||||||
|
</outerBoundaryIs>
|
||||||
|
</Polygon>
|
||||||
|
</Placemark>
|
||||||
|
</Folder>
|
||||||
|
</Folder>
|
||||||
|
</Document>
|
||||||
|
</kml>
|
||||||
Reference in New Issue
Block a user