different pie chart for types
This commit is contained in:
@@ -4698,8 +4698,8 @@ def history_view(request,userid=0):
|
||||
columns = ['hr','power','time']
|
||||
|
||||
tscript,tdiv = interactive_workouttype_piechart(g_workouts)
|
||||
|
||||
totalmeters,totalhours, totalminutes = get_totals(g_workouts)
|
||||
|
||||
totalmeters,totalhours, totalminutes, totalseconds = get_totals(g_workouts)
|
||||
totalminutes = "{totalminutes:02d}".format(totalminutes=totalminutes)
|
||||
|
||||
# meters, duration per workout type
|
||||
@@ -4716,7 +4716,7 @@ def history_view(request,userid=0):
|
||||
|
||||
for wtype in wtypes:
|
||||
a_workouts = g_workouts.filter(workouttype=wtype)
|
||||
wmeters, whours, wminutes = get_totals(a_workouts)
|
||||
wmeters, whours, wminutes,wseconds = get_totals(a_workouts)
|
||||
ddict = {}
|
||||
ddict['id'] = wtype
|
||||
try:
|
||||
@@ -4724,9 +4724,10 @@ def history_view(request,userid=0):
|
||||
except KeyError:
|
||||
ddict['wtype'] = wtype
|
||||
ddict['distance'] = wmeters
|
||||
ddict['duration'] = "{whours}:{wminutes:02d}".format(
|
||||
ddict['duration'] = "{whours}:{wminutes:02d}:{wseconds:02d}".format(
|
||||
whours=whours,
|
||||
wminutes=wminutes
|
||||
wminutes=wminutes,
|
||||
wseconds=wseconds,
|
||||
)
|
||||
ddict['nrworkouts'] = a_workouts.count()
|
||||
listofdicts.append(ddict)
|
||||
@@ -4737,9 +4738,10 @@ def history_view(request,userid=0):
|
||||
totaldiv = get_call()
|
||||
|
||||
totalsdict = {}
|
||||
totalsdict['duration'] = "{totalhours}:{totalminutes}".format(
|
||||
totalsdict['duration'] = "{totalhours}:{totalminutes}:{totalseconds}".format(
|
||||
totalhours=totalhours,
|
||||
totalminutes=totalminutes
|
||||
totalminutes=totalminutes,
|
||||
totalseconds=totalseconds
|
||||
)
|
||||
|
||||
totalsdict['distance'] = totalmeters
|
||||
@@ -4836,7 +4838,7 @@ def history_view_data(request,userid=0):
|
||||
df = dataprep.clean_df_stats(df,workstrokesonly=True,
|
||||
ignoreadvanced=True)
|
||||
|
||||
totalmeters,totalhours, totalminutes = get_totals(g_workouts)
|
||||
totalmeters,totalhours, totalminutes,totalseconds = get_totals(g_workouts)
|
||||
totalminutes = "{totalminutes:02d}".format(totalminutes=totalminutes)
|
||||
|
||||
|
||||
@@ -4853,7 +4855,7 @@ def history_view_data(request,userid=0):
|
||||
|
||||
for wtype in wtypes:
|
||||
a_workouts = g_workouts.filter(workouttype=wtype)
|
||||
wmeters, whours, wminutes = get_totals(a_workouts)
|
||||
wmeters, whours, wminutes,wseconds = get_totals(a_workouts)
|
||||
ddict = {}
|
||||
try:
|
||||
ddict['wtype'] = mytypes.workouttypes_ordered[wtype]
|
||||
@@ -4862,9 +4864,9 @@ def history_view_data(request,userid=0):
|
||||
|
||||
ddict['id'] = wtype
|
||||
ddict['distance'] = wmeters
|
||||
ddict['duration'] = "{whours}:{wminutes:02d}".format(
|
||||
ddict['duration'] = "{whours}:{wminutes:02d}:{wseconds:02d}".format(
|
||||
whours=whours,
|
||||
wminutes=wminutes
|
||||
wminutes=wminutes,wseconds=wseconds,
|
||||
)
|
||||
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
||||
try:
|
||||
|
||||
@@ -260,16 +260,17 @@ from django_mailbox.models import Message,Mailbox,MessageAttachment
|
||||
from rules.contrib.views import permission_required, objectgetter
|
||||
|
||||
def get_totals(workouts):
|
||||
totalminutes = 0
|
||||
totalseconds = 0
|
||||
totalmeters = 0
|
||||
|
||||
for w in workouts:
|
||||
totalmeters += w.distance
|
||||
totalminutes += w.duration.hour*60+w.duration.minute
|
||||
totalseconds += 60*(w.duration.hour*60+w.duration.minute)+w.duration.second
|
||||
|
||||
totalhour, totalminutes = divmod(totalminutes,60)
|
||||
hours, remainder = divmod(totalseconds,3600)
|
||||
minutes, seconds = divmod(remainder,60)
|
||||
|
||||
return totalmeters,totalhour, totalminutes
|
||||
return totalmeters,hours, minutes, seconds
|
||||
|
||||
# creating shareable views
|
||||
def allow_shares(view_func):
|
||||
|
||||
Reference in New Issue
Block a user