fixed C2 import of workout not owned
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user