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,6 +96,7 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
url = "http://localhost:8000/rowers/workout/api/upload/" url = "http://localhost:8000/rowers/workout/api/upload/"
if not testing:
response = requests.post(url,data=uploadoptions) response = requests.post(url,data=uploadoptions)
if response.status_code == 200: if response.status_code == 200:
response_json = response.json() response_json = response.json()
@@ -103,6 +104,17 @@ def processattachment(rower, fileobj, title, uploadoptions,testing=False):
else: else:
workoutid = [0] 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: if 'raceid' in uploadoptions and workoutid[0] and rower.user.is_staff:
if testing and workoutid[0]: if testing and workoutid[0]: