diff --git a/rowers/dataprepnodjango.py b/rowers/dataprepnodjango.py index 6873e7de..eb5ebae6 100644 --- a/rowers/dataprepnodjango.py +++ b/rowers/dataprepnodjango.py @@ -472,7 +472,7 @@ def delete_strokedata(id,debug=False): engine.dispose() def update_strokedata(id,df,debug=False): - delete_strokedata(id) + delete_strokedata(id,debug=debug) if debug: print "updating ",id rowdata = dataprep(df,id=id,bands=True,barchart=True,otwpower=True, @@ -935,7 +935,6 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True, # write data if id given if id != 0: - data['workoutid'] = id if debug: engine = create_engine(database_url_debug, echo=False) else: diff --git a/rowers/tasks.py b/rowers/tasks.py index 1319e010..1427f0f9 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -50,7 +50,7 @@ def handle_new_workout_from_file(r, f2, workouttype='rower', title='Workout', makeprivate=False, - notes=''): + notes='',debug=False): return new_workout_from_file(r, f2, workouttype, title, makeprivate, notes) @@ -92,7 +92,8 @@ def handle_updatedps(useremail, workoutids, debug=False): @app.task def handle_sendemail_breakthrough(workoutid, useremail, userfirstname, userlastname, - btvalues=pd.DataFrame().to_json()): + btvalues=pd.DataFrame().to_json(), + debug=False): # send email with attachment subject = "A breakthrough workout on rowsandall.com" @@ -151,7 +152,8 @@ def handle_sendemail_breakthrough(workoutid, useremail, @app.task def handle_sendemail_hard(workoutid, useremail, userfirstname, userlastname, - btvalues=pd.DataFrame().to_json()): + btvalues=pd.DataFrame().to_json(), + debug=False): # send email with attachment subject = "That was a pretty hard workout on rowsandall.com" @@ -183,7 +185,8 @@ def handle_sendemail_hard(workoutid, useremail, # send email to me when an unrecognized file is uploaded @app.task -def handle_sendemail_unrecognized(unrecognizedfile, useremail): +def handle_sendemail_unrecognized(unrecognizedfile, useremail, + debug=False): # send email with attachment fullemail = 'roosendaalsander@gmail.com' @@ -215,7 +218,8 @@ def handle_sendemail_unrecognized(unrecognizedfile, useremail): # send email to owner when an unrecognized file is uploaded @app.task -def handle_sendemail_unrecognizedowner(useremail, userfirstname): +def handle_sendemail_unrecognizedowner(useremail, userfirstname, + debug=False): # send email with attachment fullemail = useremail @@ -246,7 +250,7 @@ def handle_sendemail_unrecognizedowner(useremail, userfirstname): # Send email with TCX attachment @app.task -def handle_sendemailtcx(first_name, last_name, email, tcxfile): +def handle_sendemailtcx(first_name, last_name, email, tcxfile,debug=False): # send email with attachment fullemail = first_name + " " + last_name + " " + "<" + email + ">" @@ -269,7 +273,7 @@ def handle_sendemailtcx(first_name, last_name, email, tcxfile): @app.task -def handle_zip_file(emailfrom, subject, file): +def handle_zip_file(emailfrom, subject, file,debug=False): message = "... zip processing ... " email = EmailMessage(subject, message, emailfrom, @@ -283,7 +287,7 @@ def handle_zip_file(emailfrom, subject, file): @app.task -def handle_sendemailcsv(first_name, last_name, email, csvfile): +def handle_sendemailcsv(first_name, last_name, email, csvfile,debug=False): # send email with attachment fullemail = first_name + " " + last_name + " " + "<" + email + ">" @@ -365,7 +369,9 @@ def handle_otwsetpower(f1, boattype, weightvalue, totaltime = totaltime + rowdata.df.ix[0, ' ElapsedTime (sec)'] except KeyError: pass - df = getsmallrowdata_db(['power', 'workoutid', 'time'], ids=[workoutid]) + df = getsmallrowdata_db( + ['power', 'workoutid', 'time'], ids=[workoutid], + debug=debug) thesecs = totaltime maxt = 1.05 * thesecs logarr = datautils.getlogarr(maxt) @@ -447,7 +453,8 @@ def handle_updatecp(rower_id,workoutids,debug=False,table='cpdata'): return 1 @app.task -def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename): +def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename, + debug=False): hrmax = hrdata['hrmax'] hrut2 = hrdata['hrut2'] @@ -519,7 +526,8 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename): @app.task -def handle_sendemail_invite(email, name, code, teamname, manager): +def handle_sendemail_invite(email, name, code, teamname, manager, + debug=False): fullemail = name + ' <' + email + '>' subject = 'Invitation to join team ' + teamname message = 'Dear ' + name + ',\n\n' @@ -560,7 +568,8 @@ def handle_sendemailnewresponse(first_name, last_name, commenter_first_name, commenter_last_name, comment, - workoutname, workoutid, commentid): + workoutname, workoutid, commentid, + debug=False): fullemail = first_name + ' ' + last_name + ' <' + email + '>' subject = 'New comment on workout ' + workoutname message = 'Dear ' + first_name + ',\n\n' @@ -594,7 +603,8 @@ def handle_sendemailnewcomment(first_name, commenter_first_name, commenter_last_name, comment, workoutname, - workoutid): + workoutid, + debug=False): fullemail = first_name + ' ' + last_name + ' <' + email + '>' subject = 'New comment on workout ' + workoutname message = 'Dear ' + first_name + ',\n\n' @@ -617,7 +627,8 @@ def handle_sendemailnewcomment(first_name, @app.task -def handle_sendemail_request(email, name, code, teamname, requestor, id): +def handle_sendemail_request(email, name, code, teamname, requestor, id, + debug=False): fullemail = name + ' <' + email + '>' subject = 'Request to join team ' + teamname message = 'Dear ' + name + ',\n\n' @@ -641,7 +652,8 @@ def handle_sendemail_request(email, name, code, teamname, requestor, id): @app.task -def handle_sendemail_request_accept(email, name, teamname, managername): +def handle_sendemail_request_accept(email, name, teamname, managername, + debug=False): fullemail = name + ' <' + email + '>' subject = 'Welcome to ' + teamname message = 'Dear ' + name + ',\n\n' @@ -661,7 +673,8 @@ def handle_sendemail_request_accept(email, name, teamname, managername): @app.task -def handle_sendemail_request_reject(email, name, teamname, managername): +def handle_sendemail_request_reject(email, name, teamname, managername, + debug=False): fullemail = name + ' <' + email + '>' subject = 'Your application to ' + teamname + ' was rejected' message = 'Dear ' + name + ',\n\n' @@ -682,7 +695,8 @@ def handle_sendemail_request_reject(email, name, teamname, managername): @app.task -def handle_sendemail_member_dropped(email, name, teamname, managername): +def handle_sendemail_member_dropped(email, name, teamname, managername, + debug=False): fullemail = name + ' <' + email + '>' subject = 'You were removed from ' + teamname message = 'Dear ' + name + ',\n\n' @@ -703,7 +717,8 @@ def handle_sendemail_member_dropped(email, name, teamname, managername): @app.task -def handle_sendemail_team_removed(email, name, teamname, managername): +def handle_sendemail_team_removed(email, name, teamname, managername, + debug=False): fullemail = name + ' <' + email + '>' subject = 'Team ' + teamname + ' was deleted' message = 'Dear ' + name + ',\n\n' @@ -725,7 +740,8 @@ def handle_sendemail_team_removed(email, name, teamname, managername): @app.task -def handle_sendemail_invite_reject(email, name, teamname, managername): +def handle_sendemail_invite_reject(email, name, teamname, managername, + debug=False): fullemail = managername + ' <' + email + '>' subject = 'Your invitation to ' + name + ' was rejected' message = 'Dear ' + managername + ',\n\n' @@ -746,7 +762,8 @@ def handle_sendemail_invite_reject(email, name, teamname, managername): @app.task -def handle_sendemail_invite_accept(email, name, teamname, managername): +def handle_sendemail_invite_accept(email, name, teamname, managername, + debug=False): fullemail = managername + ' <' + email + '>' subject = 'Your invitation to ' + name + ' was accepted' message = 'Dear ' + managername + ',\n\n' @@ -763,5 +780,5 @@ def handle_sendemail_invite_accept(email, name, teamname, managername): # Another simple task for debugging purposes -def add2(x, y): +def add2(x, y,debug=False): return x + y diff --git a/rowers/utils.py b/rowers/utils.py index f4081639..b8553ca9 100644 --- a/rowers/utils.py +++ b/rowers/utils.py @@ -220,6 +220,8 @@ def isbreakthrough(delta,cpvalues,p0,p1,p2,p3,ratio): def myqueue(queue,function,*args,**kwargs): if settings.DEBUG: + kwargs['debug'] = True + print kwargs job = function.delay(*args,**kwargs) else: job = queue.enqueue(function,*args,**kwargs)