fixing FITParser
This commit is contained in:
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
@@ -34,7 +34,7 @@ class FITParser(BaseParser):
|
||||
return stream.read()
|
||||
except Exception as e:
|
||||
dologging("apilog.log", "FIT Parser")
|
||||
dolofging("apilog.log", e)
|
||||
dologging("apilog.log", e)
|
||||
raise ValueError(f"Failed to read FIT file: {str(e)}")
|
||||
|
||||
return stream.read()
|
||||
@@ -557,7 +557,8 @@ def strokedata_fit(request):
|
||||
dologging('apilog.log', request.user.username+" (strokedata_fit POST)")
|
||||
try:
|
||||
fit_data = request.data
|
||||
|
||||
if not fit_data:
|
||||
return HttpResponseBadRequest("No FIT data provided.")
|
||||
# Ensure the media directory exists
|
||||
media_dir = 'media'
|
||||
os.makedirs(media_dir, exist_ok=True)
|
||||
@@ -621,6 +622,7 @@ def strokedata_fit(request):
|
||||
'rpe': 0,
|
||||
'notes': '',
|
||||
'id': w.id,
|
||||
'workouttype': 'water',
|
||||
'offline': False,
|
||||
}
|
||||
|
||||
@@ -632,11 +634,12 @@ def strokedata_fit(request):
|
||||
uploadoptions)
|
||||
|
||||
dologging('apilog.log','FIT file uploaded, returning response')
|
||||
return JsonResponse(
|
||||
{"status": "success",
|
||||
returndict = {
|
||||
"status": "success",
|
||||
"workout public id": encoder.encode_hex(w.id),
|
||||
"workout id": w.id,
|
||||
})
|
||||
}
|
||||
return JsonResponse(returndict, status=201)
|
||||
except Exception as e:
|
||||
dologging('apilog.log','FIT API endpoint')
|
||||
dologging('apilog.log',e)
|
||||
|
||||
Reference in New Issue
Block a user