Private
Public Access
1
0

Merge branch 'develop' into feature/restapi

This commit is contained in:
Sander Roosendaal
2016-12-20 16:31:14 +01:00
7 changed files with 266 additions and 160 deletions

View File

@@ -3041,6 +3041,10 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
duration = form.cleaned_data['duration']
distance = form.cleaned_data['distance']
notes = form.cleaned_data['notes']
try:
boattype = request.POST['boattype']
except KeyError:
boattype = Workout.objects.get(id=id).boattype
startdatetime = (str(date) + ' ' + str(starttime))
startdatetime = datetime.datetime.strptime(startdatetime,
"%Y-%m-%d %H:%M:%S")
@@ -3058,6 +3062,7 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
row.notes = notes
row.duration = duration
row.distance = distance
row.boattype = boattype
row.save()
# change data in csv file
# startdatetime = dateutil.parser.parse("{}, {}".format(date,starttime))
@@ -3737,6 +3742,13 @@ def workout_upload_view(request,message=""):
f2 = z.extract(z.namelist()[0],path='media/')
fileformat = fileformat[2]
os.remove(f_to_be_deleted)
if fileformat == 'c2log':
message = "This C2 logbook summary does not contain stroke data. Please download the Export Stroke Data file from the workout details on the C2 logbook."
url = reverse(workout_upload_view,
args=[str(message)])
response = HttpResponseRedirect(url)
return response
if fileformat == 'unknown':
message = "We couldn't recognize the file type"