bug fix in training planning
This commit is contained in:
@@ -370,40 +370,40 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block scripts %}
|
{% block scripts %}
|
||||||
{% if thismicro %}
|
{% if thismicroid %}
|
||||||
<script type='text/javascript'
|
<script type='text/javascript'
|
||||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
console.log('#micro-selector-{{ thismicro.plan.plan.id }}-{{ thismicro.plan.id }}');
|
console.log('#micro-selector-{{ thismicroid|micromacroid }}-{{ thismicroid|micromesoid }}');
|
||||||
$('#micro-selector-{{ thismicro.plan.plan.id }}-{{ thismicro.plan.id }}').prop('checked',true);
|
$('#micro-selector-{{ thismicroid|micromacroid }}-{{ thismicroid|micromesoid }}').prop('checked',true);
|
||||||
$('#meso-selector-{{ thismicro.plan.plan.id }}').prop('checked',true);
|
$('#meso-selector-{{ thismicroid|micromacroid }}').prop('checked',true);
|
||||||
$('#macro-selector-{{ thismicro.plan.plan.id }}').prop('checked',true);
|
$('#macro-selector-{{ thismicroid|micromacroid }}').prop('checked',true);
|
||||||
$('#micro-{{ thismicro.id }}-{{ thismicro.plan.id }}-{{ thismicro.plan.plan.id }}').focus();
|
$('#micro-{{ thismicroid }}-{{ thismicroid|micromesoid }}-{{ thismicroid|micromacroid }}').focus();
|
||||||
console.log('done')
|
console.log('done')
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% elif thismeso %}
|
{% elif thismesoid %}
|
||||||
<script type='text/javascript'
|
<script type='text/javascript'
|
||||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#meso-selector-{{ thismeso.plan.id }}').prop('checked',true);
|
$('#meso-selector-{{ thismesoid|mesomacroid }}').prop('checked',true);
|
||||||
$('#macro-selector-{{ thismeso.plan.id }}').prop('checked',true);
|
$('#macro-selector-{{ thismesoid|mesomacroid }}').prop('checked',true);
|
||||||
$('#meso-{{ thismeso.id }}-{{ thismeso.plan.id }}').focus();
|
$('#meso-{{ thismesoid }}-{{ thismesoid|mesomacroid }}').focus();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if thismacro %}
|
{% if thismacroid %}
|
||||||
<script type='text/javascript'
|
<script type='text/javascript'
|
||||||
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('#macro-selector-{{ thismacro.id }}').prop('checked',true);
|
$('#macro-selector-{{ thismacroid }}').prop('checked',true);
|
||||||
$('#macro-{{ thismacro.id }}').focus();
|
$('#macro-{{ thismacroid }}').focus();
|
||||||
console.log('done')
|
console.log('done')
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -8,7 +8,10 @@ import datetime
|
|||||||
import re
|
import re
|
||||||
register = template.Library()
|
register = template.Library()
|
||||||
from rowers.utils import calculate_age
|
from rowers.utils import calculate_age
|
||||||
from rowers.models import course_length,WorkoutComment
|
from rowers.models import (
|
||||||
|
course_length,WorkoutComment,
|
||||||
|
TrainingMacroCycle,TrainingMesoCycle, TrainingMicroCycle
|
||||||
|
)
|
||||||
from rowers.plannedsessions import (
|
from rowers.plannedsessions import (
|
||||||
race_can_register, race_can_submit,race_rower_status
|
race_can_register, race_can_submit,race_rower_status
|
||||||
)
|
)
|
||||||
@@ -373,3 +376,39 @@ def trainingplans(rower):
|
|||||||
plans = TrainingPlan.objects.filter(rower=rower).order_by("-startdate")
|
plans = TrainingPlan.objects.filter(rower=rower).order_by("-startdate")
|
||||||
|
|
||||||
return plans
|
return plans
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def mesomacroid(id):
|
||||||
|
try:
|
||||||
|
thismeso = TrainingMesoCycle.objects.get(id=id)
|
||||||
|
except TrainingMesoCycle.DoesNotExist:
|
||||||
|
return '0'
|
||||||
|
|
||||||
|
theid = thismeso.plan.id
|
||||||
|
|
||||||
|
return str(theid)
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def micromesoid(id):
|
||||||
|
try:
|
||||||
|
thismicro = TrainingMicroCycle.objects.get(id=id)
|
||||||
|
except TrainingMicroCycle.DoesNotExist:
|
||||||
|
return '0'
|
||||||
|
|
||||||
|
theid = thismicro.plan.id
|
||||||
|
|
||||||
|
return str(theid)
|
||||||
|
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def micromacroid(id):
|
||||||
|
try:
|
||||||
|
thismicro = TrainingMicroCycle.objects.get(id=id)
|
||||||
|
except TrainingMicroCycle.DoesNotExist:
|
||||||
|
return '0'
|
||||||
|
|
||||||
|
theid = thismicro.plan.plan.id
|
||||||
|
|
||||||
|
return str(theid)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -16406,23 +16406,6 @@ def rower_trainingplan_view(request,
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
if thismicroid:
|
|
||||||
thismicro = TrainingMicroCycle.objects.get(id=int(thismicroid))
|
|
||||||
else:
|
|
||||||
if not thismacroid and not thismesoid:
|
|
||||||
thismicro = get_todays_micro(plan,thedate=startdate)
|
|
||||||
else:
|
|
||||||
thismicro = None
|
|
||||||
|
|
||||||
if thismacroid:
|
|
||||||
thismacro = TrainingMacroCycle.objects.get(id=int(thismacroid))
|
|
||||||
else:
|
|
||||||
thismacro = None
|
|
||||||
|
|
||||||
if thismesoid:
|
|
||||||
thismeso = TrainingMesoCycle.objects.get(id=int(thismesoid))
|
|
||||||
else:
|
|
||||||
thismeso = None
|
|
||||||
|
|
||||||
|
|
||||||
return render(request,'trainingplan.html',
|
return render(request,'trainingplan.html',
|
||||||
@@ -16432,9 +16415,9 @@ def rower_trainingplan_view(request,
|
|||||||
'breadcrumbs':breadcrumbs,
|
'breadcrumbs':breadcrumbs,
|
||||||
'rower':r,
|
'rower':r,
|
||||||
'cycles':cycles,
|
'cycles':cycles,
|
||||||
'thismicro':thismicro,
|
'thismicroid':thismicroid,
|
||||||
'thismacro':thismacro,
|
'thismacroid':thismacroid,
|
||||||
'thismeso':thismeso,
|
'thismesoid':thismesoid,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16483,7 +16466,7 @@ class TrainingMacroCycleUpdate(UpdateView):
|
|||||||
return reverse(rower_trainingplan_view,
|
return reverse(rower_trainingplan_view,
|
||||||
kwargs = {
|
kwargs = {
|
||||||
'id':plan.id,
|
'id':plan.id,
|
||||||
'thismacro':self.object.id,
|
'thismacroid':self.object.id,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user