new user sample data
This commit is contained in:
@@ -688,7 +688,16 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
|
||||
|
||||
# submit email task to send email about breakthrough workout
|
||||
if isbreakthrough:
|
||||
pass
|
||||
if settings.DEBUG:
|
||||
res = handle_sendemail_breakthrough(w.id,r.user.email,
|
||||
r.user.first_name,
|
||||
r.user.last_name)
|
||||
else:
|
||||
res = queuehigh.enqueue(
|
||||
handle_sendemail_breakthrough(w.id,
|
||||
r.user.email,
|
||||
r.user.first_name,
|
||||
r.user.last_name))
|
||||
|
||||
if privacy == 'visible':
|
||||
ts = Team.objects.filter(rower=r)
|
||||
|
||||
@@ -47,6 +47,42 @@ def handle_new_workout_from_file(r,f2,
|
||||
return new_workout_from_file(r,f2,workouttype,
|
||||
title,makeprivate,notes)
|
||||
|
||||
# send email when a breakthrough workout is uploaded
|
||||
@app.task
|
||||
def handle_sendemail_breakthrough(workoutid,useremail,userfirstname,userlastname):
|
||||
|
||||
# send email with attachment
|
||||
subject = "A breakthrough workout on rowsandall.com"
|
||||
message = "Dear "+userfirstname+",\n"
|
||||
message += "Congratulations! Your recent workout has been analyzed"
|
||||
message += " by Rowsandall.com and it appears your fitness,"
|
||||
message += " as measured by Critical Power, has improved!"
|
||||
message += " Critical Power (CP) is the power that you can "
|
||||
message += "sustain for a given duration. For more, see this "
|
||||
message += " article in the analytics blog:\n\n"
|
||||
message += " [link to article to be written]\n\n"
|
||||
message += "Link to the workout http://rowsandall.com/rowers/workout/"
|
||||
message += str(workoutid)
|
||||
message +="/edit\n\n"
|
||||
message +="To add the workout to your Ranking workouts and see the updated CP plot, click the following link:\n"
|
||||
message += "http://rowsandall.com/rowers/workout/"
|
||||
message += str(workoutid)
|
||||
message += "/updatecp\n\n"
|
||||
|
||||
message += "Best Regards, the Rowsandall Team"
|
||||
|
||||
email = EmailMessage(subject, message,
|
||||
'Rowsandall <info@rowsandall.com>',
|
||||
[useremail])
|
||||
|
||||
|
||||
res = email.send()
|
||||
|
||||
# remove tcx file
|
||||
os.remove(unrecognizedfile)
|
||||
return 1
|
||||
|
||||
|
||||
# send email to me when an unrecognized file is uploaded
|
||||
@app.task
|
||||
def handle_sendemail_unrecognized(unrecognizedfile,useremail):
|
||||
|
||||
@@ -343,6 +343,10 @@ def rower_register_view(request):
|
||||
response = dataprep.new_workout_from_file(therower,f2,
|
||||
title='New User Sample Data',
|
||||
notes='This is an example workout to get you started')
|
||||
newworkoutid = response[0]
|
||||
w = Workout.objects.get(id=newworkoutid)
|
||||
w.startdatetime = timezone.now()
|
||||
w.save()
|
||||
|
||||
# Create and send email
|
||||
fullemail = first_name + " " + last_name + " " + "<" + email + ">"
|
||||
|
||||
Reference in New Issue
Block a user