Merge branch 'release/v18.1.1'
This commit is contained in:
@@ -251,7 +251,8 @@ class HistorySelectForm(forms.Form):
|
||||
metricchoices = (
|
||||
("time","duration"),
|
||||
("TRIMP","trimp"),
|
||||
("rScore","rscore")
|
||||
("rScore","rscore"),
|
||||
("distance","distance")
|
||||
)
|
||||
|
||||
yaxis = forms.ChoiceField(initial='time',choices=metricchoices,label="Measure by")
|
||||
|
||||
@@ -683,7 +683,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
rscores = []
|
||||
trimps = []
|
||||
links = []
|
||||
|
||||
distances = []
|
||||
|
||||
rowersinitials = {}
|
||||
seen = ['seen']
|
||||
@@ -719,6 +719,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
du = w.duration.hour*60+w.duration.minute
|
||||
trimp = w.trimp
|
||||
rscore = w.rscore
|
||||
distance = w.distance
|
||||
if rscore == 0: # pragma: no cover
|
||||
rscore = w.hrtss
|
||||
|
||||
@@ -731,6 +732,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
durations.append(du)
|
||||
trimps.append(trimp)
|
||||
rscores.append(rscore)
|
||||
distances.append(distance)
|
||||
links.append(
|
||||
"{siteurl}/rowers/workout/{code}/".format(
|
||||
siteurl = settings.SITE_URL,
|
||||
@@ -769,6 +771,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
durations.append(0)
|
||||
trimps.append(0)
|
||||
rscores.append(0)
|
||||
distances.append(0)
|
||||
links.append('')
|
||||
types.append('rower')
|
||||
|
||||
@@ -791,6 +794,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
'rscore':rscores,
|
||||
'type':types,
|
||||
'rower':rowers,
|
||||
'distance':distances,
|
||||
'link':links,
|
||||
}
|
||||
|
||||
@@ -805,9 +809,15 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
elif yaxis == 'TRIMP':
|
||||
df.drop('duration',inplace=True,axis='columns')
|
||||
df.drop('rscore',inplace=True,axis='columns')
|
||||
df.drop('distance',inplace=True, axis='columns')
|
||||
elif yaxis == 'rScore': # pragma: no cover
|
||||
df.drop('duration',inplace=True,axis='columns')
|
||||
df.drop('trimp',inplace=True,axis='columns' )
|
||||
df.drop('distance',inplace=True, axis='columns')
|
||||
elif yaxis == 'distance':
|
||||
df.drop('duration',inplace=True,axis='columns')
|
||||
df.drop('trimp', inplace=True,axis='columns')
|
||||
df.drop('rscore',inplace=True,axis='columns')
|
||||
|
||||
df['color'] = df['type'].apply(lambda x:mapcolors(x))
|
||||
|
||||
@@ -848,9 +858,13 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
p.yaxis.axis_label = 'Duration (h)'
|
||||
elif yaxis == 'TRIMP':
|
||||
p.yaxis.axis_label = 'TRIMP'
|
||||
elif yaxis == 'distance':
|
||||
p.yaxis.axis_label = 'Distance (m)'
|
||||
else: # pragma: no cover
|
||||
p.yaxis.axis_label = 'rScore'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
p.plot_width=550
|
||||
|
||||
@@ -520,7 +520,7 @@ class TeamRequest(models.Model):
|
||||
|
||||
from rowers.utils import (
|
||||
workflowleftpanel,workflowmiddlepanel,
|
||||
defaultleft,defaultmiddle,landingpages,
|
||||
defaultleft,defaultmiddle,landingpages,landingpages2,
|
||||
steps_read_fit, steps_write_fit, ps_dict_order
|
||||
)
|
||||
|
||||
@@ -993,6 +993,10 @@ class Rower(models.Model):
|
||||
max_length=200,
|
||||
choices=landingpages,
|
||||
verbose_name="Default Landing Page")
|
||||
defaultlandingpage2 = models.CharField(default='workout_flexchart_stacked_view',
|
||||
max_length=200,
|
||||
choices=landingpages2,
|
||||
verbose_name="Alternative Landing Page")
|
||||
|
||||
# Access tokens
|
||||
c2token = models.CharField(default='',max_length=200,blank=True,null=True)
|
||||
@@ -4280,6 +4284,7 @@ class AccountRowerForm(ModelForm):
|
||||
'fav_analysis',
|
||||
'usersmooth',
|
||||
'defaultlandingpage',
|
||||
'defaultlandingpage2',
|
||||
'offercoaching','autojoin','emailalternatives']
|
||||
|
||||
widgets = {
|
||||
|
||||
@@ -35,46 +35,7 @@
|
||||
|
||||
|
||||
<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>
|
||||
<p>
|
||||
Activity chart by
|
||||
<a href="{{ request.get_path }}?yaxis=trimp">TRIMP</a>,
|
||||
<a href="{{ request.get_path }}?yaxis=rscore">rScore</a>,
|
||||
<a href="{{ request.get_path }}?yaxis=duration">Time</a>.
|
||||
</p>
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-2.2.3.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-2.2.3.min.css" type="text/css" />
|
||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-2.2.3.min.js"></script>
|
||||
<script async="true" type="text/text/javascript">
|
||||
Bokeh.set_log_level("info")
|
||||
</script>
|
||||
|
||||
{{ interactiveplot |safe }}
|
||||
|
||||
{{ the_div |safe }}
|
||||
</li>
|
||||
<li class="grid_2">
|
||||
<p>Filter on date
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</p>
|
||||
<p>and keyword</p>
|
||||
<p>
|
||||
{{ searchform }}
|
||||
</p>
|
||||
<p>
|
||||
<input name='daterange' type="submit" value="Select workouts">
|
||||
</form>
|
||||
</p>
|
||||
<p>
|
||||
<p>
|
||||
<li class="grid_4">
|
||||
<span>
|
||||
{% if workouts.has_previous %}
|
||||
{% if request.GET.q %}
|
||||
@@ -118,7 +79,6 @@
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</span>
|
||||
</p>
|
||||
</li>
|
||||
|
||||
{% if workouts %}
|
||||
@@ -137,7 +97,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="workoutcontainer">
|
||||
<div>
|
||||
<div class="icondiv">
|
||||
{% with workout.workouttype|icon|safe as templateName %}
|
||||
{% include templateName %}
|
||||
{% endwith %}
|
||||
@@ -154,8 +114,25 @@
|
||||
{% if workout|may_edit:request %}
|
||||
<a class="small"
|
||||
href={% url rower.defaultlandingpage id=workout.id|encode %}
|
||||
title="Edit">
|
||||
<i class="fas fa-search fa-fw"></i></a>
|
||||
title="{{ rower.defaultlandingpage|verbose }}">
|
||||
<i class="{{ rower.defaultlandingpage|landingicon }}"></i></a>
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="workoutelement">
|
||||
{% if workout|may_edit:request %}
|
||||
{% if rower.defaultlandingpage2 != 'workout_delete' %}
|
||||
<a class="small"
|
||||
href={% url rower.defaultlandingpage2 id=workout.id|encode %}
|
||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||
{% else %}
|
||||
<a class="small"
|
||||
href={% url rower.defaultlandingpage2 pk=workout.id|encode %}
|
||||
title="{{ rower.defaultlandingpage2|verbose }}">
|
||||
<i class="{{ rower.defaultlandingpage2|landingicon }}"></i></a>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
|
||||
{% endif %}
|
||||
@@ -168,6 +145,45 @@
|
||||
{% else %}
|
||||
<li> No workouts found </li>
|
||||
{% endif %}
|
||||
<li class="grid_4">
|
||||
<p>Filter on date
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
<table>
|
||||
{{ dateform.as_table }}
|
||||
</table>
|
||||
{% csrf_token %}
|
||||
</p>
|
||||
<p>and keyword</p>
|
||||
<p>
|
||||
{{ searchform }}
|
||||
</p>
|
||||
<p>
|
||||
<input name='daterange' type="submit" value="Select workouts">
|
||||
</form>
|
||||
</p>
|
||||
</li>
|
||||
<li class="grid_4" style="min-height:400px;">
|
||||
<p>
|
||||
Total meters: {{ totalmeters }}. Total time {{ totalhours }}:{{ totalminutes }}h.
|
||||
<a href="/rowers/history/">Dig deeper</a>.
|
||||
</p>
|
||||
<p>
|
||||
Activity chart by
|
||||
<a href="{{ request.get_path }}?yaxis=trimp">TRIMP</a>,
|
||||
<a href="{{ request.get_path }}?yaxis=rscore">rScore</a>,
|
||||
<a href="{{ request.get_path }}?yaxis=duration">Time</a>.
|
||||
</p>
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-2.2.3.min.css" type="text/css" />
|
||||
<link rel="stylesheet" href="https://cdn.pydata.org/bokeh/release/bokeh-widgets-2.2.3.min.css" type="text/css" />
|
||||
<script src="https://cdn.pydata.org/bokeh/release/bokeh-2.2.3.min.js"></script>
|
||||
<script async="true" type="text/text/javascript">
|
||||
Bokeh.set_log_level("info")
|
||||
</script>
|
||||
|
||||
{{ interactiveplot |safe }}
|
||||
|
||||
{{ the_div |safe }}
|
||||
</li>
|
||||
{% if announcements %}
|
||||
<li class="grid_4">
|
||||
<h3>What's New?</h3>
|
||||
|
||||
@@ -8,6 +8,11 @@
|
||||
<li id="charts">
|
||||
<a href="/rowers/list-graphs/"><i class="fas fa-chart-pie fa-fw"></i> Charts</a>
|
||||
</li>
|
||||
<li id="history">
|
||||
<a href="/rowers/history/">
|
||||
<i class="fas fa-history fa-fw"></i> History
|
||||
</a>
|
||||
</li>
|
||||
<li id="compare">
|
||||
{% if team %}
|
||||
<a href="/rowers/user-analysis-select/compare/team/{{ team.id }}/">
|
||||
|
||||
@@ -27,7 +27,7 @@ from rowers.mytypes import (
|
||||
otwtypes,adaptivetypes,sexcategories,weightcategories,workouttypes,
|
||||
workouttypes_icons,
|
||||
)
|
||||
from rowers.utils import NoTokenError, step_to_string
|
||||
from rowers.utils import NoTokenError, step_to_string, landingpages2
|
||||
|
||||
import rowers.payments as payments
|
||||
|
||||
@@ -72,16 +72,29 @@ favanalysisdict = {}
|
||||
for key,value in favanalysischoices:
|
||||
favanalysisdict[key] = value
|
||||
|
||||
favanalysisicons = {
|
||||
'compare':'fa-balance-scale',
|
||||
'stats':'fa-table',
|
||||
'boxplot':'fa-box-open',
|
||||
'trendflex':'fa-chart-line',
|
||||
'histogram':'fa-chart-bar',
|
||||
'flexall':'fa-chart-line',
|
||||
'cp':'fa-user-chart',
|
||||
landingpagedict = {}
|
||||
for key, value in landingpages2:
|
||||
landingpagedict[key] = value
|
||||
|
||||
landingpageicons = {
|
||||
'workout_view':'fas fa-search fa-fw',
|
||||
'workout_edit_view':'fas fa-pencil-alt fa-fw',
|
||||
'workout_workflow_view':'fas fa-tachometer-alt fa-fw',
|
||||
'workout_stats_view':'fal fa-table fa-fw',
|
||||
'workout_data_view':'fal fa-table fa-fw',
|
||||
'workout_summary_edit_view':'fas fa-pause fa-fw',
|
||||
'workout_flexchart_stacked_view':'fas fa-align-justify fa-fw',
|
||||
'workout_flexchart3_view':'fas fa-chart-line fa-fw',
|
||||
'workout_delete':'fas fa-trash-alt fa-fw'
|
||||
}
|
||||
|
||||
@register.filter
|
||||
def landingicon(landingpage):
|
||||
try:
|
||||
return landingpageicons[landingpage]
|
||||
except KeyError:
|
||||
return 'fas fa-search fa-fw'
|
||||
|
||||
@register.filter
|
||||
def steptostring(steps):
|
||||
res = ps_dict_get_description_html(steps,short=True)
|
||||
@@ -91,16 +104,9 @@ def steptostring(steps):
|
||||
@register.filter
|
||||
def verbose(s):
|
||||
try:
|
||||
return favanalysisdict[s]
|
||||
return landingpagedict[s]
|
||||
except KeyError: # pragma: no cover
|
||||
return ''
|
||||
|
||||
@register.filter
|
||||
def icon(s):
|
||||
try:
|
||||
return favanalysisicons[s]
|
||||
except KeyError: # pragma: no cover
|
||||
return 'fa-chart-line'
|
||||
return 'Details'
|
||||
|
||||
@register.filter
|
||||
def datarows(data): # pragma: no cover
|
||||
|
||||
@@ -116,6 +116,7 @@ class UserPreferencesTest(TestCase):
|
||||
'fav_analysis':'compare',
|
||||
'usersmooth':2,
|
||||
'defaultlandingpage':'workout_edit_view',
|
||||
'defaultlandingpage2':'workout_delete',
|
||||
'first_name': self.u.first_name,
|
||||
'last_name': self.u.last_name,
|
||||
'email':self.u.email
|
||||
|
||||
@@ -46,6 +46,19 @@ landingpages = (
|
||||
('workout_flexchart3_view','Workout Flex Chart')
|
||||
)
|
||||
|
||||
landingpages2 = (
|
||||
('workout_view', 'Workout View'),
|
||||
('workout_edit_view','Edit View'),
|
||||
('workout_workflow_view','Workflow View'),
|
||||
('workout_stats_view','Stats View'),
|
||||
('workout_data_view','Data Explore View'),
|
||||
('workout_summary_edit_view','Intervals Editor'),
|
||||
('workout_flexchart_stacked_view','Workout Stacked Chart'),
|
||||
('workout_flexchart3_view','Workout Flex Chart'),
|
||||
('workout_delete','Remove Workout')
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
workflowmiddlepanel = (
|
||||
|
||||
@@ -2336,6 +2336,7 @@ def history_view(request,userid=0):
|
||||
wminutes=wminutes,
|
||||
wseconds=wseconds,
|
||||
)
|
||||
ddict['distance'] = wmeters
|
||||
ddict['nrworkouts'] = a_workouts.count()
|
||||
listofdicts.append(ddict)
|
||||
|
||||
@@ -2439,9 +2440,11 @@ def history_view_data(request,userid=0):
|
||||
|
||||
yaxis = request.GET.get('yaxis','duration')
|
||||
|
||||
if yaxis.lower() not in ['duration','rscore','trimp']: # pragma: no cover
|
||||
|
||||
if yaxis.lower() not in ['duration','rscore','trimp','distance']: # pragma: no cover
|
||||
yaxis = 'duration'
|
||||
|
||||
|
||||
g_workouts = Workout.objects.filter(
|
||||
user=r,
|
||||
startdatetime__gte=activity_startdate,
|
||||
@@ -2535,9 +2538,11 @@ def history_view_data(request,userid=0):
|
||||
|
||||
totalsdict['nrworkouts'] = g_workouts.count()
|
||||
|
||||
|
||||
# activity chart
|
||||
activity_script, activity_div = interactive_activitychart2(g_workouts,startdate,enddate,yaxis=yaxis)
|
||||
|
||||
|
||||
# interactive hr pie chart
|
||||
if typeselect == 'All':
|
||||
totalseconds = 3600*totalhours+60*totalminutes+totalseconds
|
||||
|
||||
@@ -1981,7 +1981,7 @@ def workouts_view(request,message='',successmessage='',
|
||||
else:
|
||||
searchform = SearchForm()
|
||||
|
||||
paginator = Paginator(workouts,10) # show 25 workouts per page
|
||||
paginator = Paginator(workouts,12) # show 25 workouts per page
|
||||
page = request.GET.get('page',1)
|
||||
|
||||
try:
|
||||
|
||||
@@ -328,20 +328,28 @@ th.rotate > div > span {
|
||||
border-width: 1px 0 0 0;
|
||||
border-color: #333 #333 #333 #333;
|
||||
border-style: solid;
|
||||
padding: 2px;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.workoutcontainer {
|
||||
display: grid;
|
||||
grid-template-columns: 50px repeat(auto-fit, minmax(calc((100% - 100px)/4), 1fr));
|
||||
grid-template-columns: 50px repeat(auto-fit, minmax(calc((100% - 100px)/5), 1fr));
|
||||
/* grid-template-columns: 50px repeat(auto-fit, minmax(100px, 1fr)) 50px; ????*/
|
||||
padding: 5px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.workoutelement {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.icondiv {
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
}
|
||||
|
||||
.divlines h3 {
|
||||
|
||||
Reference in New Issue
Block a user