Private
Public Access
1
0

fixed C2 import of workout not owned

This commit is contained in:
Sander Roosendaal
2020-02-28 14:15:07 +01:00
parent a26caa6ea3
commit dfb8a3de75

View File

@@ -33,6 +33,8 @@ queuehigh = django_rq.get_queue('low')
from rowers.utils import myqueue
from rowers.models import C2WorldClassAgePerformance
from django.core.exceptions import PermissionDenied
def getagegrouprecord(age,sex='male',weightcategory='hwt',
distance=2000,duration=None,indf=pd.DataFrame()):
@@ -717,6 +719,12 @@ def get_workout(user,c2id):
url = "https://log.concept2.com/api/users/me/results/"+str(c2id)
s = requests.get(url,headers=headers)
if s.status_code != 200:
if s.status_code == 404:
raise PermissionDenied("You have no access to this resource")
else:
s = "Something went wrong with the import"
return custom_exception_handler(401,s), 0
data = s.json()['data']
splitdata = None