diff --git a/rowers/forms.py b/rowers/forms.py index 88f218cf..c86e6cb8 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -884,8 +884,8 @@ class WorkoutSessionSelectForm(forms.Form): class RaceResultFilterForm(forms.Form): - boatclasses = (type for type in mytypes.workouttypes if type[0] in mytypes.otwtypes) - boatclassinitial = [t for t in mytypes.otwtypes] + boatclasses = (type for type in mytypes.workouttypes if type[0] in mytypes.rowtypes) + boatclassinitial = [t for t in mytypes.rowtypes] sexchoices = ( ('female','Female'), ('male','Male'), @@ -908,7 +908,7 @@ class RaceResultFilterForm(forms.Form): boatclass = forms.MultipleChoiceField( choices=boatclasses, initial=boatclassinitial, - label='Boat Class', + label='Boat/Erg Class', widget=forms.CheckboxSelectMultiple()) boattype = forms.MultipleChoiceField( diff --git a/rowers/templates/menu_racing.html b/rowers/templates/menu_racing.html index 305818c4..e377f57f 100644 --- a/rowers/templates/menu_racing.html +++ b/rowers/templates/menu_racing.html @@ -16,6 +16,12 @@ {% if race %} + {% if results %} +
  • + +  Compare Results +
  • + {% endif %} {% if reguest.user.is_anonymous %}
  • {% if race.sessiontype == 'race' %} diff --git a/rowers/templates/multicompare.html b/rowers/templates/multicompare.html index 3096a343..78d59f2c 100644 --- a/rowers/templates/multicompare.html +++ b/rowers/templates/multicompare.html @@ -41,5 +41,9 @@ {% endblock %} {% block sidebar %} +{% if active == 'nav-racing' %} +{% include 'menu_racing.html' %} +{% else %} {% include 'menu_workouts.html' %} +{% endif %} {% endblock %} diff --git a/rowers/templates/summary_edit.html b/rowers/templates/summary_edit.html index f0bc4592..5d61d6bf 100644 --- a/rowers/templates/summary_edit.html +++ b/rowers/templates/summary_edit.html @@ -100,7 +100,7 @@
  • Detailed Summary Edit

    -

    This is still experimental and there are known bugs. Use at your own risk. Nothing is stored permanently until you hit Save on the summary above. You can use the restore original button to restore the original values.

    +

    This is still experimental and there are known bugs. Use at your own risk. Nothing is stored permanently until you hit Save in the Updated Summary section. You can use the restore original button to restore the original values.

    diff --git a/rowers/templates/virtualevent.html b/rowers/templates/virtualevent.html index cd71ec5d..9711bb3c 100644 --- a/rowers/templates/virtualevent.html +++ b/rowers/templates/virtualevent.html @@ -233,8 +233,8 @@

    Results

    {% endif %}

    + {% if results or dns %}

    - {% if results or dns %}

    @@ -245,8 +245,8 @@ - {% if race.sessiontype == 'race' %} + {% if race.sessiontype == 'race' %} {% endif %} @@ -273,8 +273,8 @@ {{ result.adaptiveclass }} {% endif %} - {% if race.sessiontype == 'race' %} + {% if race.sessiontype == 'race' %} {% endif %} @@ -308,8 +308,8 @@ {{ result.adaptiveclass }} {% endif %} - {% if race.sessiontype == 'race' %} + {% if race.sessiontype == 'race' %} {% endif %} @@ -317,10 +317,16 @@ {% endfor %}
         ClassBoatTime{{ result.boatclass }}{{ result.boattype }}{{ result.duration |durationprint:"%H:%M:%S.%f" }}{{ result.boatclass }}{{ result.boattype }}DNS
    - {% else %} - No results yet - {% endif %}

    +

    + Compare Results +

    + {% else %} +

    + No results yet +

    + {% endif %}
  • {% if form %} @@ -366,11 +372,9 @@ {{ record.username }} {{ record.teamname }} + {{ record.boatclass }} {% if race.sessiontype == 'race' %} - {{ record.boatclass }} {{ record.boattype }} - {% else %} - {{ record.boatclass }} {% endif %} {{ record.age }} {{ record.sex }} diff --git a/rowers/templates/workout_form.html b/rowers/templates/workout_form.html index d2fd7321..59136d08 100644 --- a/rowers/templates/workout_form.html +++ b/rowers/templates/workout_form.html @@ -119,7 +119,7 @@ $('#id_workouttype').change();

    {% if indoorraces %} -
  • +
  • Racing

    {% for race in indoorraces %}

    diff --git a/rowers/urls.py b/rowers/urls.py index ee3aa1ce..87312e90 100644 --- a/rowers/urls.py +++ b/rowers/urls.py @@ -278,6 +278,7 @@ urlpatterns = [ url(r'^workout/(?P\d+)/interactiveotwplot$',views.workout_otwpowerplot_view), url(r'^workout/(?P\d+)/wind$',views.workout_wind_view), url(r'^workout/(?P\d+)/image$',views.workout_uploadimage_view), + url(r'^virtualevent/(?P\d+)/compare$',views.virtualevent_compare_view), url(r'^virtualevent/(?P\d+)/image$', views.virtualevent_uploadimage_view), url(r'^virtualevent/(?P\d+)/setimage/(?P\d+)/$', diff --git a/rowers/views.py b/rowers/views.py index a2ebda25..519b1384 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -5681,6 +5681,139 @@ def team_comparison_select(request, 'teams':get_my_teams(request.user), }) +def virtualevent_compare_view(request,id=0): + results = [] + + promember = 0 + if not request.user.is_anonymous(): + r = getrower(request.user) + result = request.user.is_authenticated() and ispromember(request.user) + if result: + promember=1 + else: + r = None + + try: + race = VirtualRace.objects.get(id=id) + except VirtualRace.DoesNotExist: + raise Http404("Virtual Race does not exist") + + if race.sessiontype == 'race': + script,div = course_map(race.course) + resultobj = VirtualRaceResult + else: + script = '' + div = '' + resultobj = IndoorVirtualRaceResult + + results = resultobj.objects.filter( + race=race, + workoutid__isnull=False, + coursecompleted=True, + ).order_by("duration","-distance") + + workoutids = [result.workoutid for result in results] + + if request.method == 'GET': + xparam = race.sessionmode if race.sessionmode in ['distance','time'] else 'time' + yparam = 'pace' + plottype = 'line' + + + + request.session['ids'] = workoutids + request.session['plottype'] = plottype + request.session['xparam'] = xparam + request.session['yparam'] = yparam + + + workouts = [] + for id in workoutids: + try: + workouts.append(Workout.objects.get(id=id)) + except Workout.DoesNotExist: + pass + + labeldict = { + int(w.id): w.__unicode__() for w in workouts + } + + chartform = ChartParamChoiceForm( + initial = { + 'xparam':xparam, + 'yparam':yparam, + 'plottype':plottype, + 'teamid':0 + } + ) + elif request.method == 'POST': + chartform = ChartParamChoiceForm(request.POST) + if chartform.is_valid(): + xparam = chartform.cleaned_data['xparam'] + yparam = chartform.cleaned_data['yparam'] + plottype = chartform.cleaned_data['plottype'] + teamid = chartform.cleaned_data['teamid'] + workoutids = request.session['ids'] + request.session['ids'] = workoutids + workouts = [] + for id in workoutids: + try: + workouts.append(Workout.objects.get(id=id)) + except Workout.DoesNotExist: + pass + + labeldict = { + int(w.id): w.__unicode__() for w in workouts + } + res = interactive_multiple_compare_chart(workoutids,xparam,yparam, + promember=promember, + plottype=plottype, + labeldict=labeldict) + script = res[0] + div = res[1] + errormessage = res[3] + if errormessage != '': + messages.error(request,errormessage) + + breadcrumbs = [ + { + 'url': reverse(virtualevents_view), + 'name': 'Racing' + }, + { + 'url':reverse(virtualevent_view, + kwargs={ + 'id':race.id, + } + ), + 'name': race.name + }, + { + 'url':reverse(virtualevent_compare_view, + kwargs={ + 'id':race.id, + } + ), + 'name': 'Compare' + } + ] + + + return render(request,'multicompare.html', + {'interactiveplot':script, + 'the_div':div, + 'breadcrumbs':breadcrumbs, + 'rower':r, + 'race':race, + 'results':results, + 'active':'nav-racing', + 'promember':promember, + 'teamid':0, + 'chartform':chartform, + 'teams':[] + }) + + @login_required() def plannedsession_compare_view(request,id=0,userid=0): r = getrequestrower(request,userid=userid) @@ -17678,14 +17811,6 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0): selectedworkout = w_form.cleaned_data['workouts'] splitsecond = 0 recordid = w_form.cleaned_data['record'] -# splittime = w_form.cleaned_data['evaluate_after'] -# if splittime is not None: -# splitsecond = splittime.hour*3600 -# splitsecond += splittime.minute*60 -# splitsecond += splittime.second -# splitsecond += splittime.microsecond/1.e6 -# else: -# splitsecond = 0 else: selectedworkout = None @@ -17704,11 +17829,6 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0): workouts,race,r,recordid=recordid) - # if result: -# for w in ws: -# remove_workout_plannedsession(w,race) -# delete_race_result(w,race) - for c in comments: messages.info(request,c) for er in errors: