Private
Public Access
1
0

Merge branch 'develop' into feature/planningcoach2

This commit is contained in:
Sander Roosendaal
2018-02-09 10:35:06 +01:00
13 changed files with 149 additions and 66 deletions

View File

@@ -800,6 +800,8 @@ def ispromember(user):
r.save()
result = user.is_authenticated() and (r.rowerplan=='pro' or r.rowerplan=='coach' or r.rowerplan=='plan')
if not result and r.protrialexpires:
result = user.is_authenticated() and r.rowerplan=='basic' and r.protrialexpires >= datetime.date.today()
else:
result = False
return result
@@ -930,6 +932,33 @@ def sendmail(request):
else:
return HttpResponseRedirect('/rowers/email/')
@login_required()
def start_trial_view(request):
r = getrower(request.user)
if r.protrialexpires is not None:
messages.error(request,'You do not qualify for a trial')
url = '/rowers/promembership'
return HttpResponseRedirect(url)
r.protrialexpires = datetime.date.today()+datetime.timedelta(13)
r.save()
url = reverse(workouts_view)
messages.info(request,'We have started your 14 day trial period')
subject2 = "User started Pro Trial"
message2 = "User Started Pro Trial.\n"
message2 += request.user.email + "\n"
message2 += "User name: "+request.user.username
send_mail(subject2, message2,
'Rowsandall Server <info@rowsandall.com>',
['roosendaalsander@gmail.com'])
return HttpResponseRedirect(url)
# Create workout data from Strava or Concept2
# data and create the associated Workout object and save it
def add_workout_from_strokedata(user,importid,data,strokedata,
@@ -5060,7 +5089,8 @@ def team_comparison_select(request,
theteam = 0
if r.rowerplan == 'basic' and theteam==0:
raise Http404("Not allowed")
if r.protrialexpires is None or r.protrialexpires<datetime.date.today():
raise Http404("Not allowed")
if theteam and (theteam.viewing == 'allmembers' or theteam.manager == request.user):
workouts = Workout.objects.filter(team=theteam,