passing tests
This commit is contained in:
@@ -66,6 +66,7 @@ from django.utils import timezone
|
||||
from django.utils.html import strip_tags
|
||||
|
||||
from rowers.utils import deserialize_list,ewmovingaverage,wavg,dologging
|
||||
import rowers.utils as utils
|
||||
from rowers.emails import htmlstrip
|
||||
from rowers import mytypes
|
||||
|
||||
@@ -317,20 +318,6 @@ def handle_sporttracks_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
||||
|
||||
return 1
|
||||
|
||||
@app.task
|
||||
def handle_runkeeper_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
||||
response = requests.post(url,headers=headers,data=data)
|
||||
if response.status_code not in [200,201]: # pragma: no cover
|
||||
return 0
|
||||
|
||||
uri = response.headers["Location"]
|
||||
|
||||
tester = re.compile('^\/fitnessActivities\/(\d+)$')
|
||||
id = int(tester.match(uri).group(1))
|
||||
|
||||
res = update_workout_field_sql(workoutid,'uploadedtorunkeeper',id,debug=debug)
|
||||
|
||||
return 1
|
||||
|
||||
@app.task
|
||||
def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,description,debug=False,**kwargs):
|
||||
@@ -3008,10 +2995,7 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone
|
||||
c2id = data['id']
|
||||
workouttype = data['type']
|
||||
verified = data['verified']
|
||||
try:
|
||||
startdatetime = iso8601.parse_date(data['date_utc'])
|
||||
except: # pragma: no cover
|
||||
startdatetime = iso8601.parse_date(data['date'])
|
||||
|
||||
weightclass = data['weight_class']
|
||||
|
||||
s = 'User {userid}, C2 ID {c2id}'.format(userid=userid,c2id=c2id)
|
||||
@@ -3035,16 +3019,8 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone
|
||||
# Create CSV file name and save data to CSV file
|
||||
csvfilename ='media/Import_'+str(c2id)+'.csv.gz'
|
||||
|
||||
totaltime = data['time']/10.
|
||||
duration = totaltime_sec_to_string(totaltime)
|
||||
starttimeunix = arrow.get(startdatetime).timestamp()-totaltime
|
||||
startdatetime = arrow.get(starttimeunix)
|
||||
startdatetime,starttime,workoutdate,duration,starttimeunix,timezone = utils.get_startdatetime_from_c2data(data)
|
||||
|
||||
try:
|
||||
timezone = pytz.timezone(data['timezone'])
|
||||
except UnknownTimeZoneError:
|
||||
timezone = 'UTC'
|
||||
startdatetime = startdatetime.astimezone(timezone)
|
||||
|
||||
s = 'Time zone {timezone}, stardatetime {startdatetime}, duration {duration}'.format(
|
||||
timezone=timezone,startdatetime=startdatetime,
|
||||
@@ -3053,12 +3029,7 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone
|
||||
|
||||
|
||||
|
||||
workoutdate = startdatetime.astimezone(
|
||||
timezone
|
||||
).strftime('%Y-%m-%d')
|
||||
starttime = startdatetime.astimezone(
|
||||
timezone
|
||||
).strftime('%H:%M:%S')
|
||||
|
||||
|
||||
try:
|
||||
notes = data['comments']
|
||||
|
||||
Reference in New Issue
Block a user