show race interval as work interval in details
This commit is contained in:
@@ -3312,7 +3312,6 @@ def interactive_chart(id=0,promember=0,intervaldata = {}):
|
||||
|
||||
plot.legend.location = "bottom_right"
|
||||
|
||||
|
||||
# add shaded bar chart areas
|
||||
if intervaldata != {}:
|
||||
intervaldf = pd.DataFrame(intervaldata)
|
||||
|
||||
@@ -282,7 +282,7 @@
|
||||
<tr>
|
||||
<td>{{ forloop.counter }}</td>
|
||||
<td>
|
||||
<a href="/rowers/workout/{{ result.workoutid|encode }}">
|
||||
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
||||
{{ result.username }}</a></td>
|
||||
<td>{{ result.teamname }}</td>
|
||||
<td>{{ result.age }}</td>
|
||||
@@ -302,7 +302,7 @@
|
||||
<td>{{ result.duration |durationprint:"%H:%M:%S.%f" }}</td>
|
||||
<td>{{ result.distance }} m</td>
|
||||
<td>
|
||||
<a href="/rowers/workout/{{ result.workoutid|encode }}">
|
||||
<a href="/rowers/workout/{{ result.workoutid|encode }}/view/entry/{{ result.id }}/">
|
||||
Details</a></td>
|
||||
<td>
|
||||
{% if race.manager == request.user and not race|is_final %}
|
||||
|
||||
@@ -111,7 +111,7 @@
|
||||
|
||||
<p>
|
||||
<pre>
|
||||
{{ workout.summary }}
|
||||
{{ summary }}
|
||||
</pre>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
@@ -352,6 +352,7 @@ urlpatterns = [
|
||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/restore/$',views.workout_summary_restore_view,name='workout_summary_restore_view'),
|
||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/split/$',views.workout_split_view,name='workout_split_view'),
|
||||
# re_path(r'^workout/(?P<id>\d+)/interactiveplot/$',views.workout_biginteractive_view),
|
||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/view/entry/(?P<raceresult>\d+)/$',views.workout_view,name='workout_view'),
|
||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/view/$',views.workout_view,name='workout_view'),
|
||||
re_path(r'^workout/(?P<id>\b[0-9A-Fa-f]+\b)/video/$',views.workout_video_create_view,
|
||||
name='workout_video_create_view'),
|
||||
|
||||
@@ -2156,7 +2156,7 @@ def workout_fusion_list(request,id=0,
|
||||
|
||||
# Basic view of workout
|
||||
@permission_required('workout.view_workout',fn=get_workout_by_opaqueid,raise_exception=True)
|
||||
def workout_view(request,id=0):
|
||||
def workout_view(request,id=0,raceresult=0):
|
||||
request.session['referer'] = absolute(request)['PATH']
|
||||
|
||||
if not request.user.is_anonymous:
|
||||
@@ -2164,7 +2164,10 @@ def workout_view(request,id=0):
|
||||
else:
|
||||
rower = None
|
||||
|
||||
# get row
|
||||
row = get_workout_by_opaqueid(request,id)
|
||||
f1 = row.csvfilename
|
||||
rowdata = rdata(f1)
|
||||
|
||||
comments = WorkoutComment.objects.filter(workout=row)
|
||||
|
||||
@@ -2181,16 +2184,33 @@ def workout_view(request,id=0):
|
||||
except:
|
||||
pass
|
||||
|
||||
# get raceresult
|
||||
intervaldata = {}
|
||||
if raceresult != 0:
|
||||
try:
|
||||
result = VirtualRaceResult.objects.get(id=raceresult)
|
||||
startsecond = result.startsecond
|
||||
endsecond = result.endsecond
|
||||
duration = row.duration
|
||||
durationsecs = duration.hour*3600+duration.minute*60+duration.second
|
||||
itime = [startsecond,endsecond-startsecond]
|
||||
itype = [3,4]
|
||||
intervaldata['itime'] = itime
|
||||
intervaldata['itype'] = itype
|
||||
|
||||
rowdata.updateinterval_metric(' AverageBoatSpeed (m/s)',0.1,mode='larger',
|
||||
debug=False,smoothwindow=15.,
|
||||
activewindow = [startsecond,endsecond])
|
||||
summary = rowdata.allstats()
|
||||
except VirtualRaceResult.DoesNotExist:
|
||||
summary = row.summary
|
||||
|
||||
# create interactive plot
|
||||
res = interactive_chart(encoder.decode_hex(id))
|
||||
res = interactive_chart(encoder.decode_hex(id),intervaldata=intervaldata)
|
||||
script = res[0]
|
||||
div = res[1]
|
||||
|
||||
# create map
|
||||
f1 = row.csvfilename
|
||||
rowdata = rdata(f1)
|
||||
hascoordinates = 1
|
||||
if rowdata != 0:
|
||||
try:
|
||||
@@ -2239,6 +2259,7 @@ def workout_view(request,id=0):
|
||||
'graphs':g,
|
||||
'last_name':u.last_name,
|
||||
'records':records,
|
||||
'summary':summary,
|
||||
'recordsindoor':recordsindoor,
|
||||
'first_name':u.first_name,
|
||||
'interactiveplot':script,
|
||||
|
||||
Reference in New Issue
Block a user