Merge branch 'release/v16.5.4'
This commit is contained in:
@@ -1142,6 +1142,12 @@ def update_indoorvirtualrace(ps,cd):
|
||||
|
||||
ps.timezone = timezone_str
|
||||
|
||||
if ps.sessiontype == 'fastest_distance':
|
||||
ps.approximate_distance = ps.sessionvalue
|
||||
|
||||
if ps.course is not None:
|
||||
ps.approximate_distance = ps.course.distance
|
||||
|
||||
ps.save()
|
||||
|
||||
return 1,'Virtual Race Updated'
|
||||
@@ -1195,6 +1201,12 @@ def update_virtualrace(ps,cd):
|
||||
|
||||
ps.timezone = timezone_str
|
||||
|
||||
if ps.sessiontype == 'fastest_distance':
|
||||
ps.approximate_distance = ps.sessionvalue
|
||||
|
||||
if ps.course is not None:
|
||||
ps.approximate_distance = ps.course.distance
|
||||
|
||||
ps.save()
|
||||
|
||||
return 1,'Virtual Race Updated'
|
||||
@@ -1685,6 +1697,7 @@ def add_workout_fastestrace(ws, race, r, recordid=0, doregister=False):
|
||||
ids = [w.id for w in ws]
|
||||
ids = list(set(ids))
|
||||
|
||||
|
||||
if len(ids)>1 and race.sessiontype in ['test','coursetest','race','indoorrace','fastest_time','fastest_distance']: # pragma: no cover
|
||||
errors.append('For tests, you can only attach one workout')
|
||||
return result,comments,errors,0
|
||||
@@ -1725,10 +1738,12 @@ def add_workout_fastestrace(ws, race, r, recordid=0, doregister=False):
|
||||
errors.append("Couldn't find this entry")
|
||||
return result,comments,errors,0
|
||||
|
||||
|
||||
|
||||
records = IndoorVirtualRaceResult.objects.filter(
|
||||
userid=r.id,
|
||||
race=race,
|
||||
workoutid = ws[0].id
|
||||
#workoutid = ws[0].id
|
||||
)
|
||||
|
||||
if ws[0].workouttype != record.boatclass: # pragma: no cover
|
||||
@@ -1757,8 +1772,14 @@ def add_workout_fastestrace(ws, race, r, recordid=0, doregister=False):
|
||||
errors.append('Workout %i did not match the race window' % ws[0].id)
|
||||
return result,comments,errors,0
|
||||
|
||||
|
||||
if result>0:
|
||||
for otherrecord in records: # pragma: no cover
|
||||
oldworkouts = Workout.objects.filter(plannedsession=race)
|
||||
for oldworkout in oldworkouts:
|
||||
oldworkout.plannedsession = None
|
||||
oldworkout.save()
|
||||
|
||||
otherrecord.workoutid = None
|
||||
otherrecord.coursecompleted = False
|
||||
otherrecord.save()
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
</a>
|
||||
|
||||
<p>
|
||||
BETA: Box Chart Statistics of stroke metrics over a date range
|
||||
Box Chart Statistics of stroke metrics over a date range
|
||||
</p>
|
||||
</li>
|
||||
<li class="rounder">
|
||||
|
||||
@@ -24,6 +24,10 @@
|
||||
<form id="race_submit_form"
|
||||
method="post">
|
||||
<p>Select one of the following workouts that you rowed within the challenge window</p>
|
||||
<p>
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Submit">
|
||||
</p>
|
||||
<table width="100%">
|
||||
<tr>
|
||||
{% for field in w_form.hidden_fields %}
|
||||
@@ -37,10 +41,6 @@
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
{% csrf_token %}
|
||||
<input type="submit" value="Submit">
|
||||
</p>
|
||||
</li>
|
||||
<li class="grid_4">
|
||||
<p>
|
||||
|
||||
@@ -255,7 +255,15 @@
|
||||
<td>{{ result.points|sigdig:4 }}</td>
|
||||
{% endif %}
|
||||
<td>
|
||||
{% if race.sessiontype == 'race' %}
|
||||
<a title="Details" href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
||||
{% elif race.sessiontype == 'fastest_time' %}
|
||||
<a title="Details" href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/nocourse/">
|
||||
{% elif race.sessiontype == 'fastest_distance' %}
|
||||
<a title="Details" href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/nocourse/">
|
||||
{% else %}
|
||||
<a title="Details" href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
||||
{% endif %}
|
||||
<i class="fas fa-search-plus fa-fw"></i></a>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -2775,6 +2775,11 @@ def fastestvirtualevent_create_view(request):
|
||||
|
||||
vs.save()
|
||||
|
||||
if vs.sessiontype == 'fastest_distance':
|
||||
vs.approximate_distance = vs.sessionvalue
|
||||
|
||||
vs.save()
|
||||
|
||||
# create Site Announcement & Tweet
|
||||
if settings.DEBUG or settings.TESTING:
|
||||
dotweet = False
|
||||
@@ -3000,7 +3005,6 @@ def virtualevent_edit_view(request,id=0):
|
||||
racecreateform = VirtualRaceForm(request.POST,instance=race)
|
||||
if racecreateform.is_valid():
|
||||
cd = racecreateform.cleaned_data
|
||||
|
||||
res, message = update_virtualrace(race,cd)
|
||||
|
||||
if res:
|
||||
@@ -3253,6 +3257,7 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0):
|
||||
#workouttype__in=mytypes.rowtypes,
|
||||
startdatetime__gte=startdatetime,
|
||||
startdatetime__lte=enddatetime,
|
||||
distance__gte=race.approximate_distance,
|
||||
).order_by("-date","-startdatetime","id")
|
||||
|
||||
if not ws: # pragma: no cover
|
||||
|
||||
Reference in New Issue
Block a user