Private
Public Access
1
0

Merge branch 'release/v8.51'

This commit is contained in:
Sander Roosendaal
2018-11-20 21:41:34 +01:00
8 changed files with 97 additions and 53 deletions
+4
View File
@@ -94,6 +94,7 @@ def errorbar(fig, x, y, source=ColumnDataSource(),
xvalues = source.data[x] xvalues = source.data[x]
yvalues = source.data[y] yvalues = source.data[y]
xerrvalues = source.data['xerror'] xerrvalues = source.data['xerror']
yerrvalues = source.data['yerror'] yerrvalues = source.data['yerror']
try: try:
@@ -2362,10 +2363,13 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='',
if yparam == 'pace': if yparam == 'pace':
y_axis_type = 'datetime' y_axis_type = 'datetime'
datadf.index.names = ['index']
source = ColumnDataSource( source = ColumnDataSource(
datadf, datadf,
) )
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize' TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize'
if groupby != 'date': if groupby != 'date':
+16 -4
View File
@@ -1,6 +1,6 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models from django.db import models,IntegrityError
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.core.validators import validate_email from django.core.validators import validate_email
from django.core.exceptions import ValidationError from django.core.exceptions import ValidationError
@@ -201,9 +201,11 @@ def update_records(url=c2url):
name = name, name = name,
) )
try: try:
record.save()
except:
print record print record
record.save()
except IntegrityError:
print(record,'*')
class CalcAgePerformance(models.Model): class CalcAgePerformance(models.Model):
@@ -281,7 +283,17 @@ class C2WorldClassAgePerformance(models.Model):
unique_together = ('age','sex','weightcategory','distance') unique_together = ('age','sex','weightcategory','distance')
def __unicode__(self): def __unicode__(self):
return self.sex+' '+self.weightcategory+' '+self.name+':'+str(self.age)+' ('+str(self.season)+')' thestring = '{s} {w} {n} age {a} ({season}) {distance}m {duration} seconds'.format(
s = self.sex,
w = self.weightcategory,
n = self.name,
a = self.age,
season = self.season,
distance = self.distance,
duration = self.duration,
)
return thestring
# For future Team functionality # For future Team functionality
class Team(models.Model): class Team(models.Model):
+5
View File
@@ -590,6 +590,11 @@ def add_workout_from_data(user,importid,data,strokedata,
return id,message return id,message
def workout_strava_upload(user,w): def workout_strava_upload(user,w):
try:
thetoken = strava_open(user)
except NoTokenError:
return "Please connect to Strava first",0
message = "Uploading to Strava" message = "Uploading to Strava"
stravaid=-1 stravaid=-1
r = Rower.objects.get(user=user) r = Rower.objects.get(user=user)
+15 -13
View File
@@ -405,12 +405,13 @@ def handle_getagegrouprecords(self,
weightcategory=weightcategory,indf=df, weightcategory=weightcategory,indf=df,
) )
velo = (worldclasspower/2.8)**(1./3.) velo = (worldclasspower/2.8)**(1./3.)
try: if not np.isinf(worldclasspower) and not np.isnan(worldclasspower):
duration = distance/velo try:
wcdurations.append(duration) duration = distance/velo
wcpower.append(worldclasspower) wcdurations.append(duration)
except ZeroDivisionError: wcpower.append(worldclasspower)
pass except ZeroDivisionError:
pass
@@ -421,13 +422,14 @@ def handle_getagegrouprecords(self,
duration=duration, duration=duration,
weightcategory=weightcategory,indf=df weightcategory=weightcategory,indf=df
) )
try: if not np.isinf(worldclasspower) and not np.isnan(worldclasspower):
velo = (worldclasspower/2.8)**(1./3.) try:
distance = int(60*duration*velo) velo = (worldclasspower/2.8)**(1./3.)
wcdurations.append(60.*duration) distance = int(60*duration*velo)
wcpower.append(worldclasspower) wcdurations.append(60.*duration)
except ValueError: wcpower.append(worldclasspower)
pass except ValueError:
pass
update_agegroup_db(age,sex,weightcategory,wcdurations,wcpower, update_agegroup_db(age,sex,weightcategory,wcdurations,wcpower,
debug=debug) debug=debug)
+1 -1
View File
@@ -294,7 +294,7 @@ def upload_options(body):
try: try:
for key, value in yml.iteritems(): for key, value in yml.iteritems():
lowkey = key.lower() lowkey = key.lower()
if lowkey == 'sync' or lowkey == 'synchronization': if lowkey == 'sync' or lowkey == 'synchronization' or lowkey == 'export':
uploadoptions = getsyncoptions(uploadoptions,value) uploadoptions = getsyncoptions(uploadoptions,value)
if lowkey == 'chart' or lowkey == 'static' or lowkey == 'plot': if lowkey == 'chart' or lowkey == 'static' or lowkey == 'plot':
uploadoptions = getplotoptions(uploadoptions,value) uploadoptions = getplotoptions(uploadoptions,value)
+19 -17
View File
@@ -643,17 +643,7 @@ def get_thumbnails(request,id):
aantalcomments = len(comments) aantalcomments = len(comments)
workouttype = 'ote' favorites,maxfav = getfavorites(r,row)
if row.workouttype in mytypes.otwtypes:
workouttype = 'otw'
try:
favorites = FavoriteChart.objects.filter(user=r,
workouttype__in=[workouttype,'both']).order_by("id")
maxfav = len(favorites)-1
except:
favorites = None
maxfav = 0
charts = [] charts = []
@@ -5989,6 +5979,7 @@ def multiflex_data(request,userid=0,
if userid==0: if userid==0:
userid = request.user.id userid = request.user.id
palette = options['palette'] palette = options['palette']
groupby = options['groupby'] groupby = options['groupby']
binsize = options['binsize'] binsize = options['binsize']
@@ -6020,6 +6011,9 @@ def multiflex_data(request,userid=0,
# prepare data frame # prepare data frame
datadf,extracols = dataprep.read_cols_df_sql(ids,fieldlist) datadf,extracols = dataprep.read_cols_df_sql(ids,fieldlist)
if xparam == groupby:
datadf['groupby'] = datadf[xparam]
groupy = 'groupby'
datadf = dataprep.clean_df_stats(datadf,workstrokesonly=workstrokesonly) datadf = dataprep.clean_df_stats(datadf,workstrokesonly=workstrokesonly)
@@ -6070,14 +6064,18 @@ def multiflex_data(request,userid=0,
labels=False)) labels=False))
xvalues = groups.mean()[xparam] xvalues = groups.mean()[xparam]
yvalues = groups.mean()[yparam] yvalues = groups.mean()[yparam]
xerror = groups.std()[xparam] xerror = groups.std()[xparam]
yerror = groups.std()[yparam] yerror = groups.std()[yparam]
groupsize = groups.count()[xparam] groupsize = groups.count()[xparam]
print groupsize.sum(),groupsize.mean()
mask = groupsize <= min([0.01*groupsize.sum(),0.2*groupsize.mean()]) mask = groupsize <= min([0.01*groupsize.sum(),0.2*groupsize.mean()])
print '--------------------------'
xvalues.loc[mask] = np.nan xvalues.loc[mask] = np.nan
yvalues.loc[mask] = np.nan yvalues.loc[mask] = np.nan
xerror.loc[mask] = np.nan xerror.loc[mask] = np.nan
yerror.loc[mask] = np.nan yerror.loc[mask] = np.nan
@@ -6089,7 +6087,6 @@ def multiflex_data(request,userid=0,
yerror.dropna(inplace=True) yerror.dropna(inplace=True)
groupsize.dropna(inplace=True) groupsize.dropna(inplace=True)
if len(groupsize) == 0: if len(groupsize) == 0:
messages.error(request,'No data in selection') messages.error(request,'No data in selection')
url = reverse(user_multiflex_select) url = reverse(user_multiflex_select)
@@ -6107,6 +6104,7 @@ def multiflex_data(request,userid=0,
'groupsize':groupsize, 'groupsize':groupsize,
}) })
if yparam == 'pace': if yparam == 'pace':
df['y'] = dataprep.paceformatsecs(df['y']/1.0e3) df['y'] = dataprep.paceformatsecs(df['y']/1.0e3)
@@ -6138,8 +6136,9 @@ def multiflex_data(request,userid=0,
df['groupval'] = groups.mean()['days ago'].fillna(value=0) df['groupval'] = groups.mean()['days ago'].fillna(value=0)
groupcols = 100.*np.arange(aantal)/float(aantal) groupcols = 100.*np.arange(aantal)/float(aantal)
groupcols = (groupcols-groupcols.min())/(groupcols.max()-groupcols.min()) groupcols = (groupcols-groupcols.min())/(groupcols.max()-groupcols.min())
if aantal == 1: if aantal == 1:
groupcols = np.array([1.]) groupcols = np.array([1.])
@@ -12485,9 +12484,12 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
initial = {} initial = {}
for i in xrange(nrintervals): for i in xrange(nrintervals):
initial['intervald_%s' % i] = idist[i] try:
initial['intervalt_%s' % i] = get_time(itime[i]) initial['intervald_%s' % i] = idist[i]
initial['type_%s' % i] = itype[i] initial['intervalt_%s' % i] = get_time(itime[i])
initial['type_%s' % i] = itype[i]
except IndexError:
pass
detailform = IntervalUpdateForm(aantal=nrintervals,initial=initial) detailform = IntervalUpdateForm(aantal=nrintervals,initial=initial)
+36 -17
View File
@@ -75,7 +75,8 @@
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
font-size: 1.4em; font-size: 1.4em;
color: #dddddd; /* color: #dddddd; */
color: #f8f8ff;
padding: 15px; padding: 15px;
} }
@@ -83,7 +84,8 @@
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
font-size: 1.0em; font-size: 1.0em;
color: #dddddd; color: #f8f8ff;
/* color: #dddddd; */
} }
@@ -120,7 +122,8 @@
aside ul ul ul a { aside ul ul ul a {
list-style: none; list-style: none;
margin: 0; margin: 0;
background: #35383d; background: #144f80;
/* background: #35383d; */
} }
@@ -130,7 +133,8 @@
aside ul ul a:hover, aside ul ul a:hover,
aside ul ul ul label:hover, aside ul ul ul label:hover,
aside ul ul ul a:hover { aside ul ul ul a:hover {
background: #4d5158; /* background: #4d5158; */
background: #1c75bc;
} }
@@ -146,7 +150,8 @@
aside .cd-accordion-menu { aside .cd-accordion-menu {
width: 100%; width: 100%;
max-width: 600px; max-width: 600px;
background: #35383d; /* background: #35383d; */
background: #144f80;
} }
aside .cd-accordion-menu ul { aside .cd-accordion-menu ul {
@@ -171,7 +176,8 @@
aside .cd-accordion-menu a { aside .cd-accordion-menu a {
position: relative; position: relative;
display: block; display: block;
color: #dddddd; color: #f8f8ff;
/* color: #dddddd; */
font-size: 1.0em; font-size: 1.0em;
} }
@@ -359,14 +365,16 @@
.main-head { .main-head {
grid-area: header; grid-area: header;
background: #ededed; /* background: #ededed; */
background: #f8f8ff;
} }
.main-user { .main-user {
grid-area: user; grid-area: user;
background: #ededed; /* background: #ededed; */
background: #f8f8ff;
} }
.content { .content {
@@ -396,30 +404,38 @@
.main-nav { .main-nav {
grid-area: nav; grid-area: nav;
background: #1c75bc; /* background: #1c75bc; */
background: #1c75bc;
/* background: #144f80; */
} }
.side-nav { .side-nav {
grid-area: side-nav; grid-area: side-nav;
background: #1c75bc; background: #1c75bc;
/* background: #144f80; */
/* background: #1c75bc; */
} }
.side { .side {
grid-area: sidebar; grid-area: sidebar;
background: #35383d; /* background: #35383d; */
background: #144f80;
/* border-top: 1px solid #dddddd; */ /* border-top: 1px solid #dddddd; */
padding: 0; padding: 0;
} }
.sideheader { .sideheader {
grid-area: side-header; grid-area: side-header;
color: #dddddd; color: #f8f8ff;
background: #35383d; /* color: #dddddd; */
background: #144f80;
/* background: #35383d; */
padding: 0; padding: 0;
} }
.side h2 { .side h2 {
color: #dddddd; color: #f8f8ff;
/* color: #dddddd; */
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
font-size: 1.0em; font-size: 1.0em;
@@ -433,7 +449,8 @@
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
font-size: 1.4em; font-size: 1.4em;
color: #dddddd; color: #f8f8ff;
/* color: #dddddd; */
padding: 5px; padding: 5px;
margin: 0; margin: 0;
margin-left: 30px; margin-left: 30px;
@@ -442,7 +459,8 @@
.ad { .ad {
grid-area: ad; grid-area: ad;
background: #35383d; background: #144f80;
/* background: #35383d; */
color: #dddddd; color: #dddddd;
padding: 1em 1em 1em 1em; padding: 1em 1em 1em 1em;
} }
@@ -461,7 +479,8 @@
.main-footer { .main-footer {
grid-area: footer; grid-area: footer;
background: #ededed; /* background: #ededed; */
background: #f8f8ff;
padding: 1.2em 1.2em 1.2em 1.2em; padding: 1.2em 1.2em 1.2em 1.2em;
} }
+1 -1
View File
@@ -131,7 +131,7 @@
<li> <li>
<a href="/" title="Home"> <a href="/" title="Home">
<img src="/static/img/logo7.png" <img src="/static/img/logo7.png"
alt="Rowsandall logo" width="200px"> alt="Rowsandall logo" width="250px">
</a> </a>
</li> </li>
<li> <li>