Adding very short summary on list_workouts
This commit is contained in:
@@ -59,10 +59,14 @@
|
|||||||
|
|
||||||
<ul class="main-content">
|
<ul class="main-content">
|
||||||
<li class="grid_2" style="min-height:200px;">
|
<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>
|
<script async="true" src="https://cdn.pydata.org/bokeh/release/bokeh-1.0.4.min.js"></script>
|
||||||
|
|
||||||
{{ interactiveplot |safe }}
|
{{ interactiveplot |safe }}
|
||||||
|
|
||||||
{{ the_div |safe }}
|
{{ the_div |safe }}
|
||||||
</li>
|
</li>
|
||||||
<li class="grid_2">
|
<li class="grid_2">
|
||||||
@@ -112,11 +116,11 @@
|
|||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<span>
|
<span>
|
||||||
Page {{ workouts.number }} of {{ workouts.paginator.num_pages }}.
|
Page {{ workouts.number }} of {{ workouts.paginator.num_pages }}.
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{% if workouts.has_next %}
|
{% if workouts.has_next %}
|
||||||
{% if request.GET.q %}
|
{% if request.GET.q %}
|
||||||
<a href="{{ request.path }}?page={{ workouts.next_page_number }}&q={{ request.GET.q }}&when={{ timeperiod }}">
|
<a href="{{ request.path }}?page={{ workouts.next_page_number }}&q={{ request.GET.q }}&when={{ timeperiod }}">
|
||||||
@@ -139,7 +143,7 @@
|
|||||||
</p>
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li class="maxheight grid_4">
|
<li class="maxheight grid_4">
|
||||||
|
|
||||||
{% if workouts %}
|
{% if workouts %}
|
||||||
<table width="100%" class="listtable shortpadded">
|
<table width="100%" class="listtable shortpadded">
|
||||||
<thead>
|
<thead>
|
||||||
@@ -189,7 +193,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<td>
|
<td>
|
||||||
<a href={% url rower.defaultlandingpage id=workout.id|encode %}>No Name
|
<a href={% url rower.defaultlandingpage id=workout.id|encode %}>No Name
|
||||||
</a></td>
|
</a></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if workout.name != '' %}
|
{% if workout.name != '' %}
|
||||||
@@ -251,9 +255,9 @@
|
|||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
@@ -277,7 +281,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
|
|||||||
@@ -259,6 +259,18 @@ from django_mailbox.models import Message,Mailbox,MessageAttachment
|
|||||||
|
|
||||||
from rules.contrib.views import permission_required, objectgetter
|
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
|
# creating shareable views
|
||||||
def allow_shares(view_func):
|
def allow_shares(view_func):
|
||||||
def sharify(request, *args, **kwargs):
|
def sharify(request, *args, **kwargs):
|
||||||
|
|||||||
@@ -2009,6 +2009,8 @@ def workouts_view(request,message='',successmessage='',
|
|||||||
g_enddate,
|
g_enddate,
|
||||||
stack=stack)
|
stack=stack)
|
||||||
|
|
||||||
|
totalmeters,totalhours, totalminutes = get_totals(g_workouts)
|
||||||
|
|
||||||
|
|
||||||
messages.info(request,successmessage)
|
messages.info(request,successmessage)
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
@@ -2036,6 +2038,9 @@ def workouts_view(request,message='',successmessage='',
|
|||||||
'interactiveplot':script,
|
'interactiveplot':script,
|
||||||
'the_div':div,
|
'the_div':div,
|
||||||
'timeperiod':timeperiod,
|
'timeperiod':timeperiod,
|
||||||
|
'totalmeters':totalmeters,
|
||||||
|
'totalminutes':totalminutes,
|
||||||
|
'totalhours':totalhours,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user