Merge tag 'v6.87' into develop
releasing workout form improvements
This commit is contained in:
@@ -748,9 +748,8 @@ def fetchcp(rower,theworkouts,table='cpdata'):
|
||||
|
||||
|
||||
# create a new workout from manually entered data
|
||||
def create_row_df(r,distance,duration,startdatetime,
|
||||
title = 'Manually added workout',notes='',
|
||||
workouttype='rower'):
|
||||
def create_row_df(r,distance,duration,startdatetime,workouttype='rower'):
|
||||
|
||||
|
||||
|
||||
nr_strokes = int(distance/10.)
|
||||
@@ -808,10 +807,10 @@ def create_row_df(r,distance,duration,startdatetime,
|
||||
row.write_csv(csvfilename, gzip = True)
|
||||
|
||||
id, message = save_workout_database(csvfilename, r,
|
||||
title=title,
|
||||
notes=notes,
|
||||
# title=title,
|
||||
# notes=notes,
|
||||
dosmooth=False,
|
||||
workouttype=workouttype,
|
||||
# workouttype=workouttype,
|
||||
consistencychecks=False,
|
||||
totaltime=totalseconds)
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ $( document ).ready(function() {
|
||||
$(this).val() == 'rower'
|
||||
|| $(this).val() == 'skierg'
|
||||
|| $(this).val() == 'dynamic'
|
||||
|| $(this).val() == 'sliders'
|
||||
|| $(this).val() == 'slides'
|
||||
|| $(this).val() == 'paddle'
|
||||
|| $(this).val() == 'snow'
|
||||
) {
|
||||
|
||||
@@ -6,6 +6,34 @@
|
||||
|
||||
{% get_current_timezone as TIME_ZONE %}
|
||||
|
||||
|
||||
{% block scripts %}
|
||||
|
||||
<script type='text/javascript'
|
||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||
</script>
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$('#id_workouttype').on('change', function(){
|
||||
if (
|
||||
$(this).val() == 'rower'
|
||||
|| $(this).val() == 'skierg'
|
||||
|| $(this).val() == 'dynamic'
|
||||
|| $(this).val() == 'slides'
|
||||
|| $(this).val() == 'paddle'
|
||||
|| $(this).val() == 'snow'
|
||||
) {
|
||||
$('#id_boattype').toggle(false);
|
||||
$('#id_boattype').val('1x');
|
||||
} else {
|
||||
$('#id_boattype').toggle(true);
|
||||
}
|
||||
});
|
||||
$('#id_workouttype').change();
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<div class="grid_12 alpha">
|
||||
<h1>Add Workout Manually</h1>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<script type='text/javascript'
|
||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||
</script>
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
|
||||
|
||||
<script>
|
||||
$( document ).ready(function() {
|
||||
$('#id_workouttype').on('change', function(){
|
||||
@@ -26,7 +26,7 @@ $( document ).ready(function() {
|
||||
$(this).val() == 'rower'
|
||||
|| $(this).val() == 'skierg'
|
||||
|| $(this).val() == 'dynamic'
|
||||
|| $(this).val() == 'sliders'
|
||||
|| $(this).val() == 'slides'
|
||||
|| $(this).val() == 'paddle'
|
||||
|| $(this).val() == 'snow'
|
||||
) {
|
||||
|
||||
@@ -450,6 +450,8 @@ class DataTest(TestCase):
|
||||
'notes':'Aap noot \n mies',
|
||||
'weightcategory':'lwt',
|
||||
'workouttype':'water',
|
||||
'boattype':'1x',
|
||||
'private':False,
|
||||
}
|
||||
form = WorkoutForm(data=form_data)
|
||||
self.assertTrue(form.is_valid())
|
||||
@@ -680,6 +682,8 @@ class ViewTest(TestCase):
|
||||
'distance':'15000',
|
||||
'weightcategory':'hwt',
|
||||
'workouttype':'rower',
|
||||
'boattype':'1x',
|
||||
'private':True,
|
||||
'notes':'noot mies',
|
||||
}
|
||||
form = WorkoutForm(data=form_data)
|
||||
|
||||
@@ -3604,6 +3604,7 @@ def addmanual_view(request):
|
||||
distance = form.cleaned_data['distance']
|
||||
notes = form.cleaned_data['notes']
|
||||
thetimezone = form.cleaned_data['timezone']
|
||||
private = form.cleaned_data['private']
|
||||
try:
|
||||
boattype = request.POST['boattype']
|
||||
except KeyError:
|
||||
@@ -3617,6 +3618,11 @@ def addmanual_view(request):
|
||||
except KeyError:
|
||||
rankingpiece =- Workout.objects.get(id=id).rankingpiece
|
||||
|
||||
if private:
|
||||
privacy = 'private'
|
||||
else:
|
||||
privacy = 'visible'
|
||||
|
||||
startdatetime = (str(date) + ' ' + str(starttime))
|
||||
startdatetime = datetime.datetime.strptime(startdatetime,
|
||||
"%Y-%m-%d %H:%M:%S")
|
||||
@@ -3628,10 +3634,10 @@ def addmanual_view(request):
|
||||
|
||||
id,message = dataprep.create_row_df(r,
|
||||
distance,
|
||||
weightcategory,
|
||||
# weightcategory,
|
||||
duration,startdatetime,
|
||||
title = name,
|
||||
notes=notes,
|
||||
# title = name,
|
||||
# notes=notes,
|
||||
workouttype=workouttype)
|
||||
|
||||
|
||||
@@ -3642,7 +3648,12 @@ def addmanual_view(request):
|
||||
if id:
|
||||
w = Workout.objects.get(id=id)
|
||||
w.rankingpiece = rankingpiece or is_ranking_piece(w)
|
||||
w.privacy = privacy
|
||||
w.weightcategory = weightcategory
|
||||
w.notes = notes
|
||||
w.name = name
|
||||
w.workouttype = workouttype
|
||||
w.boattype = boattype
|
||||
w.save()
|
||||
messages.info(request,'New workout created')
|
||||
|
||||
@@ -7541,7 +7552,7 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
|
||||
def instroke_view(request,id=0):
|
||||
row = get_workout(id)
|
||||
|
||||
form = WorkoutForm(instance=row)
|
||||
# form = WorkoutForm(instance=row)
|
||||
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
|
||||
# check if user is owner of this workout
|
||||
|
||||
@@ -7573,7 +7584,7 @@ def instroke_view(request,id=0):
|
||||
def workout_geeky_view(request,id=0,message="",successmessage=""):
|
||||
row = get_workout(id)
|
||||
|
||||
form = WorkoutForm(instance=row)
|
||||
# form = WorkoutForm(instance=row)
|
||||
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
|
||||
rowdata = rrdata(csvfile=row.csvfilename)
|
||||
instrokemetrics = rowdata.get_instroke_columns()
|
||||
@@ -8131,7 +8142,7 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
|
||||
def workout_advanced_view(request,id=0,message="",successmessage=""):
|
||||
row = get_workout(id)
|
||||
|
||||
form = WorkoutForm(instance=row)
|
||||
# form = WorkoutForm(instance=row)
|
||||
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
|
||||
for i in g:
|
||||
try:
|
||||
@@ -8851,7 +8862,7 @@ def workout_export_view(request,id=0, message="", successmessage=""):
|
||||
rkuserid = 0
|
||||
|
||||
|
||||
form = WorkoutForm(instance=row)
|
||||
# form = WorkoutForm(instance=row)
|
||||
g = GraphImage.objects.filter(workout=row).order_by("-creationdatetime")
|
||||
for i in g:
|
||||
try:
|
||||
@@ -10175,11 +10186,13 @@ def workout_getc2workout_view(request,c2id):
|
||||
distance,
|
||||
duration,
|
||||
startdatetime,
|
||||
title = 'Imported from C2',
|
||||
# title = 'Imported from C2',
|
||||
workouttype=workouttype)
|
||||
|
||||
w = Workout.objects.get(id=id)
|
||||
w.uploadedtoc2 = c2id
|
||||
w.name = 'Imported from C2'
|
||||
w.workouttype = 'rower'
|
||||
w.save()
|
||||
|
||||
message = "This workout does not have any stroke data associated with it. We created synthetic stroke data."
|
||||
|
||||
Reference in New Issue
Block a user