Private
Public Access
1
0

Merge branch 'release/v3.21'

This commit is contained in:
Sander Roosendaal
2017-06-27 04:17:52 +02:00
12 changed files with 627 additions and 18 deletions
+1 -1
View File
@@ -428,7 +428,7 @@ def save_workout_database(f2,r,dosmooth=True,workouttype='rower',
isbreakthrough = False
if workouttype == 'water':
delta,cpvalues,avgpower = datautils.getsinglecp(row.df)
if utils.isbreakthrough(delta,cpvalues,r.p0,r.p1,r.p2,r.p3):
if utils.isbreakthrough(delta,cpvalues,r.p0,r.p1,r.p2,r.p3,r.cpratio):
isbreakthrough = True
res = datautils.updatecp(delta,cpvalues,r)
+1
View File
@@ -27,6 +27,7 @@ def updatecp(delta,cpvalues,r):
r.p1 = p1[1]
r.p2 = p1[2]
r.p3 = p1[3]
r.cpratio = res[3]
r.save()
+1 -1
View File
@@ -131,7 +131,7 @@ class PredictedPieceForm(forms.Form):
)
pieceunit = forms.ChoiceField(required=True,choices=unitchoices,
initial='t',label='Unit')
value = forms.IntegerField(initial=10,label='Value')
value = forms.FloatField(initial=10,label='Value')
class Meta:
fields = ['value','pieceunit']
+1 -1
View File
@@ -687,7 +687,7 @@ def interactive_otwcpchart(powerdf,promember=0):
script, div = components(plot)
return [script,div,p1,message]
return [script,div,p1,ratio,message]
def interactive_cpchart(thedistances,thesecs,theavpower,
theworkouts,promember=0):
+1
View File
@@ -178,6 +178,7 @@ class Rower(models.Model):
p1 = models.FloatField(default=1.0,verbose_name="CP p2")
p2 = models.FloatField(default=1.0,verbose_name="CP p3")
p3 = models.FloatField(default=1.0,verbose_name="CP p4")
cpratio = models.FloatField(default=1.0,verbose_name="CP fit ratio")
otwslack = models.IntegerField(default=0,verbose_name="OTW Power slack")
+596
View File
@@ -0,0 +1,596 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
<script src="/static/cookielaw/js/cookielaw.js"></script>
<link rel="stylesheet" href="/static/css/bokeh-0.12.3.min.css" type="text/css" />
<link rel="stylesheet" href="/static/css/bokeh-widgets-0.12.3.min.css" type="text/css" />
<link rel="shortcut icon" href="/static/img/favicon.ico" type="image/x-icon" />
<link rel="icon" sizes="32x32" href="/static/img/favicon-32x32.png" type="image/png"/>
<link rel="icon" sizes="64x64" href="/static/img/favicon-64x64.png" type="image/png"/>
<link rel="icon" sizes="192x192" href="/static/img/favicon-192x192.png" type="image/png"/>
<link rel="icon" sizes="16x16" href="/static/img/favicon-16x16.png" type="image/png"/>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=0.67">
<title>Rowsandall</title>
<link rel="stylesheet" href="/static/css/reset.css" />
<link rel="stylesheet" href="/static/css/text.css" />
<link rel="stylesheet" href="/static/css/960_12_col.css" />
<link rel="stylesheet" href="/static/css/rowsandall.css" />
<!-- Google Analytics disabled on internal IP address
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-96318020-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
-->
</head>
<body>
<div class="container_12">
<div class="grid_12">
&nbsp;
</div>
<div class="grid_12">
<div id="logo" class="grid_6 alpha">
<p><a href="/"><img src="/static/img/logo7.png"
alt="Rowsandall logo" height="80"></a></p>
</div>
<div class="grid_6 omega">
<div class="grid_4 alpha">
<div class="grid_1 alpha">
<p id="header">
<a class="button gray small" href="/rowers/videos">Videos</a></p>
</div>
<div class="grid_2">
<p id="header">
<a class="button gray small" href="http://analytics.rowsandall.com/">Rowing Analytics BLOG</a></p>
</div>
<div class="grid_1 omega">
<p id="header">
<a class="button gray small" href="/rowers/email">Contact</a>
</p>
</div>
<div class="grid_4 alpha">
<p>Free Data and Analysis. For Rowers. By Rowers.</p>
</div>
</div>
<div class="grid_1">
<div class="grid_1 tooltip">
<p><a class="button gray small" href="/login/">login</a> </p>
</div>
<div class="grid_1">
<p>&nbsp</p>
</div>
</div>
<div class="grid_1 omega">
<div class="grid_1"><a class="button green small" href="/rowers/promembership">Upgrade to Pro</a></div>
</div>
</div>
</div>
<div class="grid_12">
<div class="grid_1 alpha tooltip">
<p><a class="button green small" href="/rowers/register">Register (free)</a></p>
</div>
<div class="grid_1 tooltip">
<p>&nbsp;</p>
</div>
<div class="grid_2 tooltip">
<p>&nbsp;</p>
</div>
<div class="grid_1 tooltip">
<p>&nbsp;</p>
</div>
<div class="grid_2 tooltip">
<p>&nbsp;</p>
</div>
<div class="grid_1 tooltip">
<p>&nbsp;</p>
</div>
</div>
<div class="clear"></div>
<div class="grid_12">
</div>
<div class="grid_12">
<div class="grid_12">
<h1>Error 502 Bad Gateway</h1>
<p>
No valid server response received. This can have multiple reasons,
including time-outs or reaching the capacity limit.
</p>
</div>
</div>
<div class="clear"></div>
<div class="grid_12 omega" >
<p id="footer"></p>
<div class="grid_2 alpha">
<p id="footer"><a href="/rowers/email/">&copy; Sander Roosendaal</a></p>
</div>
<div class="grid_1">
<p id="footer">
<a href="/rowers/about">About</a></p>
</div>
<div class="grid_1">
<p id="footer">
<a href="/rowers/brochure">Brochure</a></p>
</div>
<div class="grid_1">
<p id="footer">
<a href="/rowers/developers">Develop</a></p>
</div>
<div class="grid_1">
<p id="footer">
<a href="/rowers/legal">Legal</a></p>
</div>
<div class="grid_1">
<p id="footer">
<a href="/rowers/partners">Partners</a></p>
</div>
<div class="grid_1">
<p id="footer">
<a href="/rowers/physics">Physics</a></p>
</div>
<div class="grid_2">
<p id="footer">
<a href="http://analytics.rowsandall.com/">Rowing Analytics BLOG</a></p>
</div>
<div class="grid_2 omega">
<p id="footer">
<a href="https://www.facebook.com/groups/rowsandall/">Facebook group</a></p>
</div>
</div>
</div>
<!-- end container -->
<!-- Clicky disabled on internal IP address
<script type="text/javascript">
var clicky = { log: function(){ return; }, goal: function(){ return; }};
var clicky_site_ids = clicky_site_ids || [];
clicky_site_ids.push(101011008);
var clicky_custom = {};
(function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '//static.getclicky.com/js';
( document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0] ).appendChild( s );
})();
</script>
<noscript><p><img alt="Clicky" width="1" height="1" src="//in.getclicky.com/101011008ns.gif" /></p></noscript>
-->
<link rel="stylesheet" href="/static/debug_toolbar/css/print.css" type="text/css" media="print" />
<link rel="stylesheet" href="/static/debug_toolbar/css/toolbar.css" type="text/css" />
<!-- Prevent our copy of jQuery from registering as an AMD module on sites that use RequireJS. -->
<script src="/static/debug_toolbar/js/jquery_pre.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="/static/debug_toolbar/js/jquery_post.js"></script>
<script src="/static/debug_toolbar/js/toolbar.js"></script>
<div id="djDebug" class="djdt-hidden" dir="ltr"
data-store-id="b03ff2a671fc45f29549fcefbad74672" data-render-panel-url="/__debug__/render_panel/"
>
<div class="djdt-hidden" id="djDebugToolbar">
<ul id="djDebugPanelList">
<li><a id="djHideToolBarButton" href="#" title="Hide toolbar">Hide &#187;</a></li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtVersionsPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Versions" class="VersionsPanel">
Versions
<br /><small>Django 1.9.5</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtTimerPanel" checked="checked" title="Disable for next and successive requests" />
<div class="djdt-contentless">
Time
<br /><small>Total: 456.00ms</small>
</div>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtSettingsPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Settings from &lt;code&gt;rowsandall_app.settings_dev&lt;/code&gt;" class="SettingsPanel">
Settings
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtHeadersPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Headers" class="HeadersPanel">
Headers
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtRequestPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Request" class="RequestPanel">
Request
<br /><small>error500_view</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtSQLPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="SQL queries from 0 connections" class="SQLPanel">
SQL
<br /><small>0 queries in 0.00ms</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtStaticFilesPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Static files (1470 found, 0 used)" class="StaticFilesPanel">
Static files
<br /><small>0 files used</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtTemplatesPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Templates (3 rendered)" class="TemplatesPanel">
Templates
<br /><small>500.html</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtCachePanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Cache calls from 1 backend" class="CachePanel">
Cache
<br /><small>0 calls in 0.00ms</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtSignalsPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Signals" class="SignalsPanel">
Signals
<br /><small>17 receivers of 12 signals</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtLoggingPanel" checked="checked" title="Disable for next and successive requests" />
<a href="#" title="Log messages" class="LoggingPanel">
Logging
<br /><small>0 messages</small>
</a>
</li>
<li class="djDebugPanelButton">
<input type="checkbox" data-cookie="djdtRedirectsPanel" title="Enable for next and successive requests" />
<div class="djdt-contentless djdt-disabled">
Intercept redirects
</div>
</li>
</ul>
</div>
<div class="djdt-hidden" id="djDebugToolbarHandle">
<span title="Show toolbar" id="djShowToolBarButton">&#171;</span>
</div>
<div id="VersionsPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Versions</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="SettingsPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Settings from <code>rowsandall_app.settings_dev</code></h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="HeadersPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Headers</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="RequestPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Request</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="SQLPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>SQL queries from 0 connections</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="StaticFilesPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Static files (1470 found, 0 used)</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="TemplatesPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Templates (3 rendered)</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="CachePanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Cache calls from 1 backend</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="SignalsPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Signals</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="LoggingPanel" class="djdt-panelContent">
<div class="djDebugPanelTitle">
<a href="" class="djDebugClose"></a>
<h3>Log messages</h3>
</div>
<div class="djDebugPanelContent">
<img src="/static/debug_toolbar/img/ajax-loader.gif" alt="loading" class="djdt-loader" />
<div class="djdt-scroll"></div>
</div>
</div>
<div id="djDebugWindow" class="djdt-panelContent"></div>
</div>
</body>
</html>
+2 -1
View File
@@ -164,6 +164,7 @@
<thead>
<tr>
<th> Duration</th>
<th> Power (upper)</th>
<th> Power</th>
<tr>
</thead>
@@ -171,7 +172,7 @@
{% for pred in cpredictions %}
<tr>
{% for key, value in pred.items %}
{% if key == "power" %}
{% if key == "power" or key == "upper" %}
<td> {{ value }} W </td>
{% endif %}
{% if key == "duration" %}
+1
View File
@@ -111,6 +111,7 @@ urlpatterns = [
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^api/workouts/(?P<id>\d+)/strokedata$',views.strokedatajson),
url(r'^500v/$',views.error500_view),
url(r'^502/$', TemplateView.as_view(template_name='502.html'),name='502'),
url(r'^500/$', TemplateView.as_view(template_name='500.html'),name='500'),
url(r'^404/$', TemplateView.as_view(template_name='404.html'),name='404'),
url(r'^400/$', TemplateView.as_view(template_name='400.html'),name='400'),
+3 -1
View File
@@ -76,11 +76,13 @@ def geo_distance(lat1,lon1,lat2,lon2):
return [distance,bearing]
def isbreakthrough(delta,cpvalues,p0,p1,p2,p3):
def isbreakthrough(delta,cpvalues,p0,p1,p2,p3,ratio):
pwr = p0/(1+delta/p2)
pwr += p1/(1+delta/p3)
pwr *= ratio
res = np.sum(cpvalues>pwr)
return res>1
+14 -7
View File
@@ -2955,14 +2955,16 @@ def otwrankings_view(request,theuser=0,
script = res[0]
div = res[1]
p1 = res[2]
ratio = res[3]
r.p0 = p1[0]
r.p1 = p1[1]
r.p2 = p1[2]
r.p3 = p1[3]
r.cpratio = ratio
r.save()
paulslope = 1
paulintercept = 1
message = res[3]
message = res[4]
else:
script = ''
div = '<p>No ranking pieces found.</p>'
@@ -2977,18 +2979,20 @@ def otwrankings_view(request,theuser=0,
clean = form.is_valid()
value = form.cleaned_data['value']
hourvalue,value = divmod(value,60)
hourvalue = int(hourvalue)
minutevalue = int(value)
value = int(60*(value-minutevalue))
if hourvalue >= 24:
hourvalue = 23
rankingdurations.append(datetime.time(minute=value,hour=hourvalue))
rankingdurations.append(datetime.time(minute=minutevalue,
hour=hourvalue,
second=value))
else:
form = PredictedPieceForm()
predictions = []
cpredictions = []
for rankingduration in rankingdurations:
t = 3600.*rankingduration.hour
t += 60.*rankingduration.minute
@@ -3000,13 +3004,17 @@ def otwrankings_view(request,theuser=0,
pwr = p1[0]/(1+t/p1[2])
pwr += p1[1]/(1+t/p1[3])
if pwr <= 0:
pwr = 50.
if not np.isnan(pwr):
pwr2 = pwr*ratio
a = {
'duration':timedeltaconv(t),
'power':int(pwr)}
'power':int(pwr),
'upper':int(pwr2)}
cpredictions.append(a)
@@ -3017,7 +3025,6 @@ def otwrankings_view(request,theuser=0,
{'rankingworkouts':theworkouts,
'interactiveplot':script,
'the_div':div,
'predictions':predictions,
'cpredictions':cpredictions,
'avgpower':avgpower,
'form':form,
BIN
View File
Binary file not shown.
+5 -5
View File
@@ -134,11 +134,11 @@ WSGI_APPLICATION = 'rowsandall_app.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'rowsanda_107501',
'USER': 'rowsanda_107501',
'PASSWORD': 'roeidata',
'HOST': 'store3.rosti.cz',
'PORT': '3306',
'NAME': CFG['db_name'],
'USER': CFG['db_user'],
'PASSWORD': CFG['db_password'],
'HOST': CFG['db_host'],
'PORT': CFG['db_port'],
},
'slave': {
'ENGINE': 'django.db.backends.sqlite3',