indoor racing improvements
more descriptive form labels, new race set to organizer time zone, link back to race from workout view
This commit is contained in:
@@ -2000,9 +2000,20 @@ class IndoorVirtualRaceForm(ModelForm):
|
||||
'evaluation_closure':AdminSplitDateTime(),
|
||||
}
|
||||
|
||||
labels = {
|
||||
'sessionunit': 'Meters or minutes',
|
||||
'sessionvalue': 'How far or how long'
|
||||
}
|
||||
|
||||
|
||||
def __init__(self,*args,**kwargs):
|
||||
timezone = kwargs.pop('timezone',None)
|
||||
super(IndoorVirtualRaceForm, self).__init__(*args, **kwargs)
|
||||
self.fields['sessionunit'].choices = [('min','minutes'),('m','meters')]
|
||||
self.fields['sessionvalue'].initial = 2000
|
||||
self.fields['sessionunit'].initial = 'm'
|
||||
if timezone:
|
||||
self.fields['timezone'].initial = timezone
|
||||
|
||||
def clean(self):
|
||||
cd = self.cleaned_data
|
||||
|
||||
@@ -38,6 +38,22 @@
|
||||
<h1>{{ workout.name }}</h1>
|
||||
<ul class="main-content">
|
||||
<li class="grid_2">
|
||||
{% if records %}
|
||||
{% for record in records %}
|
||||
<p>
|
||||
This workout was a race. See race result here:
|
||||
<a href="/rowers/virtualevent/{{ record.race.id }}">{{ record.race.name }}</a>
|
||||
</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if recordsindoor %}
|
||||
{% for record in recordsindoor %}
|
||||
<p>
|
||||
This workout was a race. See race result here:
|
||||
<a href="/rowers/virtualevent/{{ record.race.id }}">{{ record.race.name }}</a>
|
||||
</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
<p>
|
||||
<div class="fb-share-button"
|
||||
data-href="https://rowsandall.com/rowers/workout/{{ workout.id }}"
|
||||
|
||||
@@ -7343,6 +7343,9 @@ def workout_view(request,id=0):
|
||||
|
||||
u = row.user.user
|
||||
|
||||
recordsindoor = IndoorVirtualRaceResult.objects.filter(workoutid= row.id)
|
||||
records = VirtualRaceResult.objects.filter(workoutid= row.id)
|
||||
|
||||
return render(request, 'workout_view.html',
|
||||
{'workout':row,
|
||||
'rower':rower,
|
||||
@@ -7350,6 +7353,8 @@ def workout_view(request,id=0):
|
||||
'active':'nav-workouts',
|
||||
'graphs':g,
|
||||
'last_name':u.last_name,
|
||||
'records':records,
|
||||
'recordsindoor':recordsindoor,
|
||||
'first_name':u.first_name,
|
||||
'interactiveplot':script,
|
||||
'aantalcomments':aantalcomments,
|
||||
@@ -17048,7 +17053,7 @@ def indoorvirtualevent_create_view(request):
|
||||
return HttpResponseRedirect(url)
|
||||
else:
|
||||
|
||||
racecreateform = IndoorVirtualRaceForm()
|
||||
racecreateform = IndoorVirtualRaceForm(timezone=r.defaulttimezone)
|
||||
|
||||
|
||||
breadcrumbs = [
|
||||
@@ -17464,6 +17469,20 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0):
|
||||
startdatetime__lte=enddatetime,
|
||||
).order_by("date","startdatetime","id")
|
||||
|
||||
if not ws:
|
||||
messages.info(
|
||||
request,
|
||||
'You have no workouts executed during the race window. Please upload a result or enter it manually.'
|
||||
)
|
||||
|
||||
url = reverse(virtualevent_view,
|
||||
kwargs = {
|
||||
'id':id
|
||||
})
|
||||
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
|
||||
initialworkouts = [w.id for w in Workout.objects.filter(
|
||||
user=r,plannedsession=race
|
||||
)]
|
||||
|
||||
Reference in New Issue
Block a user