working MPV
This commit is contained in:
@@ -226,6 +226,61 @@ def course_view(request,id=0):
|
||||
|
||||
script,div = course_map(course)
|
||||
|
||||
# get results
|
||||
records = VirtualRaceResult.objects.filter(
|
||||
course=course,
|
||||
workoutid__isnull=False,
|
||||
coursecompleted=True).order_by("duration","-distance")
|
||||
|
||||
form = RaceResultFilterForm(records=records,groups=False)
|
||||
if request.method == 'POST':
|
||||
form = RaceResultFilterForm(request.POST,records=records,groups=False)
|
||||
if form.is_valid():
|
||||
cd = form.cleaned_data
|
||||
try:
|
||||
sex = cd['sex']
|
||||
except KeyError:
|
||||
sex = ['female','male','mixed']
|
||||
|
||||
try:
|
||||
boattype = cd['boattype']
|
||||
except KeyError:
|
||||
boattype = mytypes.waterboattype
|
||||
|
||||
try:
|
||||
boatclass = cd['boatclass']
|
||||
except KeyError:
|
||||
boatclass = [t for t in mytypes.otwtypes]
|
||||
|
||||
age_min = cd['age_min']
|
||||
age_max = cd['age_max']
|
||||
|
||||
try:
|
||||
weightcategory = cd['weightcategory']
|
||||
except KeyError:
|
||||
weightcategory = ['hwt','lwt']
|
||||
|
||||
try:
|
||||
adaptiveclass = cd['adaptiveclass']
|
||||
except KeyError:
|
||||
adaptiveclass = ['None','PR1','PR2','PR3','FES']
|
||||
|
||||
print(age_min,age_max)
|
||||
|
||||
records = VirtualRaceResult.objects.filter(
|
||||
course=course,
|
||||
workoutid__isnull=False,
|
||||
coursecompleted=True,
|
||||
weightcategory__in=weightcategory,
|
||||
sex__in=sex,
|
||||
age__gte=age_min,
|
||||
age__lte=age_max,
|
||||
boatclass__in=boatclass,
|
||||
boattype__in=boattype,
|
||||
adaptiveclass__in=adaptiveclass,
|
||||
).order_by("duration","-distance")
|
||||
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url': reverse('virtualevents_view'),
|
||||
@@ -249,7 +304,9 @@ def course_view(request,id=0):
|
||||
'mapscript':script,
|
||||
'mapdiv':div,
|
||||
'nosessions':False,
|
||||
'records':records,
|
||||
'rower':r,
|
||||
'form':form,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -2374,7 +2374,7 @@ def workout_view(request,id=0,raceresult=0,sessionresult=0,nocourseraceresult=0)
|
||||
else:
|
||||
latitudes = rowdata.df[' latitude']
|
||||
longitudes = rowdata.df[' longitude']
|
||||
mapscript,mapdiv = leaflet_chart(latitudes,longitudes,row.name,)
|
||||
mapscript,mapdiv = leaflet_chart(latitudes,longitudes,row.name,raceresult=raceresult)
|
||||
|
||||
|
||||
else:
|
||||
@@ -6163,9 +6163,11 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
||||
courseselectform = CourseSelectForm()
|
||||
has_latlon,lat_mean,lon_mean = dataprep.workout_has_latlon(row.id)
|
||||
if has_latlon:
|
||||
courses = getnearestcourses([lat_mean,lon_mean],GeoCourse.objects.all(),whatisnear=25)
|
||||
courses = getnearestcourses([lat_mean,lon_mean],GeoCourse.objects.all(),whatisnear=25,
|
||||
strict=True)
|
||||
courseselectform = CourseSelectForm(choices=courses)
|
||||
|
||||
|
||||
powerupdateform = PowerIntervalUpdateForm(initial=data)
|
||||
|
||||
if request.method == 'POST' and "course" in request.POST:
|
||||
|
||||
Reference in New Issue
Block a user