Merge branch 'develop' into feature/redesign2
This commit is contained in:
@@ -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
@@ -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):
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -405,6 +405,7 @@ def handle_getagegrouprecords(self,
|
|||||||
weightcategory=weightcategory,indf=df,
|
weightcategory=weightcategory,indf=df,
|
||||||
)
|
)
|
||||||
velo = (worldclasspower/2.8)**(1./3.)
|
velo = (worldclasspower/2.8)**(1./3.)
|
||||||
|
if not np.isinf(worldclasspower) and not np.isnan(worldclasspower):
|
||||||
try:
|
try:
|
||||||
duration = distance/velo
|
duration = distance/velo
|
||||||
wcdurations.append(duration)
|
wcdurations.append(duration)
|
||||||
@@ -421,6 +422,7 @@ def handle_getagegrouprecords(self,
|
|||||||
duration=duration,
|
duration=duration,
|
||||||
weightcategory=weightcategory,indf=df
|
weightcategory=weightcategory,indf=df
|
||||||
)
|
)
|
||||||
|
if not np.isinf(worldclasspower) and not np.isnan(worldclasspower):
|
||||||
try:
|
try:
|
||||||
velo = (worldclasspower/2.8)**(1./3.)
|
velo = (worldclasspower/2.8)**(1./3.)
|
||||||
distance = int(60*duration*velo)
|
distance = int(60*duration*velo)
|
||||||
|
|||||||
+1
-1
@@ -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)
|
||||||
|
|||||||
+11
-12
@@ -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)
|
||||||
|
|
||||||
@@ -6076,8 +6070,12 @@ def multiflex_data(request,userid=0,
|
|||||||
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)
|
||||||
|
|
||||||
@@ -6140,6 +6138,7 @@ def multiflex_data(request,userid=0,
|
|||||||
|
|
||||||
|
|
||||||
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.])
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user