more or less done
This commit is contained in:
@@ -48,6 +48,9 @@ def analysis_new(request,
|
||||
firstworkout = get_workout(id)
|
||||
if not is_workout_team(request.user, firstworkout): # pragma: no cover
|
||||
raise PermissionDenied("You are not allowed to use this workout")
|
||||
if workout_is_strava(firstworkout):
|
||||
messages.error(request, "You cannot use Strava workouts for analysis")
|
||||
raise PermissionDenied("You cannot use Strava workouts for analysis")
|
||||
firstworkoutquery = Workout.objects.filter(id=encoder.decode_hex(id))
|
||||
|
||||
try:
|
||||
@@ -218,6 +221,7 @@ def analysis_new(request,
|
||||
)
|
||||
if firstworkout:
|
||||
workouts = firstworkoutquery | workouts
|
||||
|
||||
workouts = workouts.order_by(
|
||||
"-date", "-starttime"
|
||||
).exclude(boattype__in=negtypes)
|
||||
@@ -253,7 +257,7 @@ def analysis_new(request,
|
||||
else:
|
||||
selectedworkouts = Workout.objects.filter(id__in=ids)
|
||||
|
||||
form.fields["workouts"].queryset = workouts | selectedworkouts
|
||||
form.fields["workouts"].queryset = (workouts | selectedworkouts).exclude(workoutsource='strava')
|
||||
|
||||
optionsform = AnalysisOptionsForm(initial={
|
||||
'modality': modality,
|
||||
|
||||
@@ -3397,12 +3397,12 @@ def virtualevent_submit_result_view(request, id=0, workoutid=0):
|
||||
startdatetime__gte=startdatetime,
|
||||
startdatetime__lte=enddatetime,
|
||||
distance__gte=race.approximate_distance,
|
||||
).order_by("-date", "-startdatetime", "id")
|
||||
).order_by("-date", "-startdatetime", "id").exclude(workoutsource='strava')
|
||||
|
||||
if not ws: # pragma: no cover
|
||||
messages.info(
|
||||
request,
|
||||
'You have no workouts executed during the race window. Please upload a result or enter it manually.'
|
||||
'You have no eligible workouts executed during the race window. Please upload a result or enter it manually.'
|
||||
)
|
||||
|
||||
url = reverse('virtualevent_view',
|
||||
@@ -3436,6 +3436,7 @@ def virtualevent_submit_result_view(request, id=0, workoutid=0):
|
||||
splitsecond = 0
|
||||
recordid = w_form.cleaned_data['record']
|
||||
else:
|
||||
messages.error(request,"Error in form")
|
||||
selectedworkout = None
|
||||
|
||||
if selectedworkout is not None:
|
||||
@@ -3518,7 +3519,12 @@ def virtualevent_submit_result_view(request, id=0, workoutid=0):
|
||||
|
||||
else:
|
||||
if workoutid:
|
||||
workoutdata['initial'] = encoder.decode_hex(workoutid)
|
||||
try:
|
||||
w = Workout.objects.get(id=workoutid)
|
||||
if w.workoutsource != 'strava':
|
||||
workoutdata['initial'] = encoder.decode_hex(workoutid)
|
||||
except Workout.DoesNotExist:
|
||||
pass
|
||||
w_form = WorkoutRaceSelectForm(workoutdata, entries)
|
||||
|
||||
breadcrumbs = [
|
||||
|
||||
@@ -82,7 +82,8 @@ from rowers.rower_rules import (
|
||||
can_add_workout_member, can_plan_user, is_paid_coach,
|
||||
can_start_trial, can_start_plantrial, can_start_coachtrial,
|
||||
can_plan, is_workout_team,
|
||||
is_promember,user_is_basic, is_coachtrial, is_coach
|
||||
is_promember,user_is_basic, is_coachtrial, is_coach,
|
||||
workout_is_strava
|
||||
)
|
||||
|
||||
from django.shortcuts import render
|
||||
|
||||
Reference in New Issue
Block a user