small fixes and additional logging for rp3
This commit is contained in:
@@ -12,6 +12,8 @@ import gzip
|
||||
import base64
|
||||
from io import BytesIO
|
||||
|
||||
from rowers.utils import dologging
|
||||
|
||||
import django_rq
|
||||
queue = django_rq.get_queue('default')
|
||||
queuelow = django_rq.get_queue('low')
|
||||
@@ -135,6 +137,7 @@ def get_rp3_workouts(rower,do_async=True): # pragma: no cover
|
||||
if (res.status_code != 200):
|
||||
return 0
|
||||
|
||||
dologging('rp3_import.log',res.json())
|
||||
workouts_list = pd.json_normalize(res.json()['data']['workouts'])
|
||||
try:
|
||||
rp3ids = workouts_list['id'].values
|
||||
@@ -150,6 +153,7 @@ def get_rp3_workouts(rower,do_async=True): # pragma: no cover
|
||||
|
||||
for id in newids:
|
||||
startdatetime = workouts_list.loc[id,'executed_at']
|
||||
dologging('rp3_import.log',startdatetime)
|
||||
|
||||
job = myqueue(
|
||||
queuehigh,
|
||||
|
||||
@@ -2929,6 +2929,8 @@ def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,max_attempts,de
|
||||
|
||||
|
||||
with open(filename,'wb') as f:
|
||||
#dologging('rp3_import.log',res.text)
|
||||
dologging('rp3_import.log','Rp3 ID = {id}'.format(id=rp3id))
|
||||
f.write(res.content)
|
||||
|
||||
uploadoptions = {
|
||||
|
||||
@@ -4824,7 +4824,7 @@ def workout_upload_api(request):
|
||||
stravaid = post_data.get('stravaid','')
|
||||
c2id = post_data.get('c2id','')
|
||||
nkid = post_data.get('nkid','')
|
||||
rp3id = post_data.get('nkid','')
|
||||
rp3id = post_data.get('rp3id','')
|
||||
garminid = post_data.get('garminid',0)
|
||||
|
||||
startdatetime = post_data.get('startdatetime','')
|
||||
@@ -4893,6 +4893,7 @@ def workout_upload_api(request):
|
||||
make_plot = optionsform.cleaned_data['make_plot']
|
||||
plottype = optionsform.cleaned_data['plottype']
|
||||
upload_to_c2 = optionsform.cleaned_data['upload_to_C2']
|
||||
|
||||
upload_to_strava = optionsform.cleaned_data['upload_to_Strava']
|
||||
upload_to_st = optionsform.cleaned_data['upload_to_SportTracks']
|
||||
upload_to_tp = optionsform.cleaned_data['upload_to_TrainingPeaks']
|
||||
@@ -6229,6 +6230,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
)
|
||||
messages.info(request,'We are checking your time on the course in the background')
|
||||
|
||||
vals = None
|
||||
# feeling lucky / ruptures
|
||||
if request.method == 'POST' and "ruptures" in request.POST:
|
||||
df = pd.DataFrame({
|
||||
@@ -6444,7 +6446,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
})
|
||||
savebutton = 'savestringform'
|
||||
|
||||
vals = None
|
||||
|
||||
# we are saving the results obtained from the power update form
|
||||
elif request.method == 'POST' and 'selector' in request.POST:
|
||||
powerupdateform = PowerIntervalUpdateForm(request.POST)
|
||||
|
||||
Reference in New Issue
Block a user