Private
Public Access
1
0

passing email tests - still not doing everything

This commit is contained in:
Sander Roosendaal
2020-02-09 18:40:09 +01:00
parent 50b253d9a2
commit 3909ce3127

View File

@@ -96,12 +96,24 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
url = "http://localhost:8000/rowers/workout/api/upload/"
response = requests.post(url,data=uploadoptions)
if response.status_code == 200:
response_json = response.json()
workoutid = [int(response_json['id'])]
else:
workoutid = [0]
if not testing:
response = requests.post(url,data=uploadoptions)
if response.status_code == 200:
response_json = response.json()
workoutid = [int(response_json['id'])]
else:
workoutid = [0]
# this is ugly and needs to be done better
if testing:
workoutid = [
make_new_workout_from_email(therower, filename, title,testing=testing)
]
if workoutid[0] and uploadoptions and not 'error' in uploadoptions:
workout = Workout.objects.get(id=workoutid[0])
uploads.make_private(workout, uploadoptions)
uploads.set_workouttype(workout, uploadoptions)
uploads.do_sync(workout, uploadoptions)
if 'raceid' in uploadoptions and workoutid[0] and rower.user.is_staff: