Adding very short summary on list_workouts
This commit is contained in:
@@ -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