fix
This commit is contained in:
@@ -117,14 +117,14 @@ def add_workout_from_data(userid, nkid, data, strokedata, source='nk', splitdata
|
||||
session.headers.update(newHeaders)
|
||||
|
||||
response = session.post(UPLOAD_SERVICE_URL, json=uploadoptions)
|
||||
|
||||
|
||||
if response.status_code != 200: # pragma: no cover
|
||||
return 0, response.text
|
||||
|
||||
try:
|
||||
workoutid = response.json()['id']
|
||||
except KeyError: # pragma: no cover
|
||||
workoutid = 1
|
||||
workoutid = 0
|
||||
|
||||
# dologging('nklog.log','Workout ID {id}'.format(id=workoutid))
|
||||
|
||||
|
||||
@@ -3411,9 +3411,12 @@ def handle_nk_async_workout(alldata, userid, nktoken, nkid, delaysec, defaulttim
|
||||
if workoutid == 0:
|
||||
return 0
|
||||
|
||||
workout = Workout.objects.get(id=workoutid)
|
||||
newnkid = workout.uploadedtonk
|
||||
sr = create_or_update_syncrecord(workout.user, workout, nkid=newnkid)
|
||||
try:
|
||||
workout = Workout.objects.get(id=workoutid)
|
||||
newnkid = workout.uploadedtonk
|
||||
sr = create_or_update_syncrecord(workout.user, workout, nkid=newnkid)
|
||||
except Workout.DoesNotExist:
|
||||
pass
|
||||
|
||||
return workoutid
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ def mocked_session(*args, **kwargs):
|
||||
self.headers = MockHeaders()
|
||||
|
||||
def post(self, *args, **kwargs):
|
||||
return MockResponse({},200)
|
||||
return MockResponse({'id':1},200)
|
||||
|
||||
class MockHeaders:
|
||||
def update(*args, **kwargs):
|
||||
@@ -133,7 +133,6 @@ def mocked_session(*args, **kwargs):
|
||||
self.ok = True
|
||||
|
||||
|
||||
|
||||
return MockEngine()
|
||||
|
||||
def mocked_sqlalchemy(*args, **kwargs):
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -5390,6 +5390,7 @@ def workout_upload_api(request):
|
||||
}
|
||||
)
|
||||
_ = send_confirm(r.user, t, link, '')
|
||||
|
||||
return JSONResponse(status=statuscode, data=message)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user