Private
Public Access
1
0

c2 to async

This commit is contained in:
Sander Roosendaal
2020-03-09 22:11:35 +01:00
parent cd43218e84
commit 050db5b560
6 changed files with 72 additions and 23 deletions

View File

@@ -75,7 +75,7 @@ def strip_tags(html):
from rowers.dataprepnodjango import (
update_strokedata, new_workout_from_file,
getsmallrowdata_db, updatecpdata_sql,
getsmallrowdata_db, updatecpdata_sql,update_c2id_sql,
update_agegroup_db,fitnessmetric_to_sql,
add_c2_stroke_data_db,totaltime_sec_to_string,
create_c2_stroke_data_db,update_empower,
@@ -121,7 +121,18 @@ def add(x, y):
return x + y
@app.task
def handle_c2_sync(workoutid,url,headers,data,debug=True,**kwargs):
response = requests.post(url,headers=headers,data=data)
if response.status_code not in [200,201]:
return 0
s = response.json()
c2id = s['data']['id']
res = update_c2id_sql(workoutid,c2id)
return res
@app.task
def handle_c2_import_stroke_data(c2token,