fixing garmin sync
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -175,7 +175,8 @@ def garmin_getworkout(garminid,r,activity):
|
|||||||
|
|
||||||
return w
|
return w
|
||||||
|
|
||||||
def garmin_workouts_from_details(activities):
|
def garmin_workouts_from_details(data):
|
||||||
|
activities = data['activityDetails']
|
||||||
for activity in activities:
|
for activity in activities:
|
||||||
try:
|
try:
|
||||||
garmintoken = activity['userAccessToken']
|
garmintoken = activity['userAccessToken']
|
||||||
|
|||||||
@@ -66,6 +66,20 @@ class GarminObjects(DjangoTestCase):
|
|||||||
|
|
||||||
self.assertEqual(len(data),515)
|
self.assertEqual(len(data),515)
|
||||||
|
|
||||||
|
def test_garmin_push_details4(self):
|
||||||
|
data = json.load(open('rowers/tests/testdata/garmindetail4.txt','r'))
|
||||||
|
response = self.c.post('/rowers/garmin/activities/',json.dumps(data),
|
||||||
|
content_type='application/json')
|
||||||
|
|
||||||
|
self.assertEqual(response.status_code, 200)
|
||||||
|
|
||||||
|
ws = Workout.objects.filter(user=self.r)
|
||||||
|
self.assertEqual(ws.count(),1)
|
||||||
|
|
||||||
|
data,w = dataprep.getrowdata_db(id=ws[0].id)
|
||||||
|
|
||||||
|
self.assertEqual(len(data),18)
|
||||||
|
|
||||||
def test_garmin_push_details2(self):
|
def test_garmin_push_details2(self):
|
||||||
data = json.load(open('rowers/tests/testdata/garmindetail2.txt','r'))
|
data = json.load(open('rowers/tests/testdata/garmindetail2.txt','r'))
|
||||||
response = self.c.post('/rowers/garmin/activities/',json.dumps(data),
|
response = self.c.post('/rowers/garmin/activities/',json.dumps(data),
|
||||||
|
|||||||
3
rowers/tests/testdata/garmindetail1.txt
vendored
3
rowers/tests/testdata/garmindetail1.txt
vendored
@@ -1,4 +1,4 @@
|
|||||||
[ { "userId": "25858854-f086-4026-83ac-a3bfc97dcbb1",
|
{"activityDetails":[ { "userId": "25858854-f086-4026-83ac-a3bfc97dcbb1",
|
||||||
"userAccessToken": "dfdzf",
|
"userAccessToken": "dfdzf",
|
||||||
"summaryId" : "14098044-detail",
|
"summaryId" : "14098044-detail",
|
||||||
"summary" : {
|
"summary" : {
|
||||||
@@ -72,3 +72,4 @@
|
|||||||
"movingDurationInSeconds" : 0
|
"movingDurationInSeconds" : 0
|
||||||
} ]
|
} ]
|
||||||
} ]
|
} ]
|
||||||
|
}
|
||||||
|
|||||||
3
rowers/tests/testdata/garmindetail2.txt
vendored
3
rowers/tests/testdata/garmindetail2.txt
vendored
File diff suppressed because one or more lines are too long
4
rowers/tests/testdata/garmindetail3.txt
vendored
4
rowers/tests/testdata/garmindetail3.txt
vendored
File diff suppressed because one or more lines are too long
2
rowers/tests/testdata/garmindetail4.txt
vendored
Normal file
2
rowers/tests/testdata/garmindetail4.txt
vendored
Normal file
File diff suppressed because one or more lines are too long
2
rowers/tests/testdata/garminlog.log
vendored
Normal file
2
rowers/tests/testdata/garminlog.log
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user