Adding very short summary on list_workouts
This commit is contained in:
@@ -59,6 +59,10 @@
|
||||
|
||||
<ul class="main-content">
|
||||
<li class="grid_2" style="min-height:200px;">
|
||||
<p>
|
||||
Total meters: {{ totalmeters }}. Total time {{ totalhours }}:{{ totalminutes }}h.
|
||||
<a href="/rowers/history/">Dig deeper</a>.
|
||||
</p>
|
||||
<script async="true" src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
|
||||
|
||||
{{ interactiveplot |safe }}
|
||||
|
||||
@@ -259,6 +259,18 @@ from django_mailbox.models import Message,Mailbox,MessageAttachment
|
||||
|
||||
from rules.contrib.views import permission_required, objectgetter
|
||||
|
||||
def get_totals(workouts):
|
||||
totalminutes = 0
|
||||
totalmeters = 0
|
||||
|
||||
for w in workouts:
|
||||
totalmeters += w.distance
|
||||
totalminutes += w.duration.hour*60+w.duration.minute
|
||||
|
||||
totalhour, totalminutes = divmod(totalminutes,60)
|
||||
|
||||
return totalmeters,totalhour, totalminutes
|
||||
|
||||
# creating shareable views
|
||||
def allow_shares(view_func):
|
||||
def sharify(request, *args, **kwargs):
|
||||
|
||||
@@ -2009,6 +2009,8 @@ def workouts_view(request,message='',successmessage='',
|
||||
g_enddate,
|
||||
stack=stack)
|
||||
|
||||
totalmeters,totalhours, totalminutes = get_totals(g_workouts)
|
||||
|
||||
|
||||
messages.info(request,successmessage)
|
||||
messages.error(request,message)
|
||||
@@ -2036,6 +2038,9 @@ def workouts_view(request,message='',successmessage='',
|
||||
'interactiveplot':script,
|
||||
'the_div':div,
|
||||
'timeperiod':timeperiod,
|
||||
'totalmeters':totalmeters,
|
||||
'totalminutes':totalminutes,
|
||||
'totalhours':totalhours,
|
||||
})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user