bug fix
This commit is contained in:
@@ -572,8 +572,10 @@ def get_workout(user,c2id):
|
|||||||
if 'workout' in data:
|
if 'workout' in data:
|
||||||
if 'splits' in data['workout']:
|
if 'splits' in data['workout']:
|
||||||
splitdata = data['workout']['splits']
|
splitdata = data['workout']['splits']
|
||||||
if 'intervals' in data['workout']:
|
elif 'intervals' in data['workout']:
|
||||||
splitdata = data['workout']['intervals']
|
splitdata = data['workout']['intervals']
|
||||||
|
else:
|
||||||
|
splitdata = None
|
||||||
|
|
||||||
# Check if workout has stroke data, and get the stroke data
|
# Check if workout has stroke data, and get the stroke data
|
||||||
|
|
||||||
|
|||||||
64
rowers/tests/c2jsonintervaldata.txt
Normal file
64
rowers/tests/c2jsonintervaldata.txt
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
{
|
||||||
|
"date": "2017-05-01 14:33:00",
|
||||||
|
"timezone": "Australia/Melbourne",
|
||||||
|
"workout_type": "VariableInterval",
|
||||||
|
"type": "rower",
|
||||||
|
"weight_class": "H",
|
||||||
|
"time": 16800,
|
||||||
|
"distance": 6721,
|
||||||
|
"rest_distance": 236,
|
||||||
|
"rest_time": 2700,
|
||||||
|
"calories_total": 427,
|
||||||
|
"drag_factor": 175,
|
||||||
|
"stroke_count": 996,
|
||||||
|
"stroke_rate": 33,
|
||||||
|
"workout": {
|
||||||
|
"intervals": [
|
||||||
|
{
|
||||||
|
"type": "time",
|
||||||
|
"time": 2400,
|
||||||
|
"distance": 1011,
|
||||||
|
"rest_time": 600,
|
||||||
|
"rest_distance": 43,
|
||||||
|
"stroke_rate": 35,
|
||||||
|
"calories_total": 68
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "time",
|
||||||
|
"time": 3000,
|
||||||
|
"distance": 1229,
|
||||||
|
"rest_time": 600,
|
||||||
|
"rest_distance": 59,
|
||||||
|
"stroke_rate": 34,
|
||||||
|
"calories_total": 80
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "time",
|
||||||
|
"time": 3000,
|
||||||
|
"distance": 1190,
|
||||||
|
"rest_time": 600,
|
||||||
|
"rest_distance": 59,
|
||||||
|
"stroke_rate": 33,
|
||||||
|
"calories_total": 75
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "time",
|
||||||
|
"time": 2400,
|
||||||
|
"distance": 971,
|
||||||
|
"rest_time": 750,
|
||||||
|
"rest_distance": 44,
|
||||||
|
"stroke_rate": 34,
|
||||||
|
"calories_total": 62
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "time",
|
||||||
|
"time": 6000,
|
||||||
|
"distance": 2320,
|
||||||
|
"rest_time": 150,
|
||||||
|
"rest_distance": 31,
|
||||||
|
"stroke_rate": 32,
|
||||||
|
"calories_total": 142
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
47
rowers/tests/c2jsonsplitdata.txt
Normal file
47
rowers/tests/c2jsonsplitdata.txt
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"date": "2017-05-16 17:24:00",
|
||||||
|
"timezone": "US/Pacific",
|
||||||
|
"workout_type": "FixedTimeSplits",
|
||||||
|
"type": "rower",
|
||||||
|
"weight_class": "H",
|
||||||
|
"time": 6000,
|
||||||
|
"distance": 1789,
|
||||||
|
"stroke_count": 314,
|
||||||
|
"drag_factor": 134,
|
||||||
|
"stroke_rate": 31,
|
||||||
|
"calories_total": 90,
|
||||||
|
"workout": {
|
||||||
|
"splits": [
|
||||||
|
{
|
||||||
|
"time": 1200,
|
||||||
|
"calories_total": 18,
|
||||||
|
"stroke_rate": 33,
|
||||||
|
"distance": 354
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"time": 1200,
|
||||||
|
"calories_total": 18,
|
||||||
|
"stroke_rate": 31,
|
||||||
|
"distance": 355
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"time": 1200,
|
||||||
|
"calories_total": 18,
|
||||||
|
"stroke_rate": 32,
|
||||||
|
"distance": 357
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"time": 1200,
|
||||||
|
"calories_total": 18,
|
||||||
|
"stroke_rate": 31,
|
||||||
|
"distance": 363
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"time": 1200,
|
||||||
|
"calories_total": 18,
|
||||||
|
"stroke_rate": 30,
|
||||||
|
"distance": 361
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
BIN
rowers/tests/testdata/testdata.csv.gz
vendored
Binary file not shown.
2
rowers/tests/testdata/testdata.tcx
vendored
2
rowers/tests/testdata/testdata.tcx
vendored
@@ -2502,7 +2502,7 @@
|
|||||||
</Trackpoint>
|
</Trackpoint>
|
||||||
</Track>
|
</Track>
|
||||||
</Lap>
|
</Lap>
|
||||||
<Notes><Element 'Notes' at 0x187d63c8></Notes>
|
<Notes><Element 'Notes' at 0x1d49a6d8></Notes>
|
||||||
</Activity>
|
</Activity>
|
||||||
</Activities>
|
</Activities>
|
||||||
<Creator>
|
<Creator>
|
||||||
|
|||||||
@@ -11369,8 +11369,10 @@ def workout_getimportview(request,externalid,source = 'c2'):
|
|||||||
if 'workout' in data:
|
if 'workout' in data:
|
||||||
if 'splits' in data['workout']:
|
if 'splits' in data['workout']:
|
||||||
splitdata = data['workout']['splits']
|
splitdata = data['workout']['splits']
|
||||||
if 'intervals' in data['workout']:
|
elif 'intervals' in data['workout']:
|
||||||
splitdata = data['workout']['intervals']
|
splitdata = data['workout']['intervals']
|
||||||
|
else:
|
||||||
|
splitdata = False
|
||||||
else:
|
else:
|
||||||
splitdata = False
|
splitdata = False
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user