Private
Public Access
1
0

Merge branch 'develop' into feature/ranking

This commit is contained in:
Sander Roosendaal
2018-01-16 15:36:55 +01:00
5 changed files with 46 additions and 19 deletions

View File

@@ -2038,7 +2038,7 @@ def dataprep(rowdatadf, id=0, bands=True, barchart=True, otwpower=True,
if barchart:
# time increments for bar chart
time_increments = rowdatadf.ix[:, ' ElapsedTime (sec)'].diff()
time_increments[0] = time_increments[1]
time_increments.ix[0] = time_increments.ix[1]
time_increments = 0.5 * time_increments + 0.5 * np.abs(time_increments)
x_right = (t2 + time_increments.apply(lambda x: timedeltaconv(x)))

View File

@@ -1482,13 +1482,14 @@ def interactive_cpchart(rower,thedistances,thesecs,theavpower,
# fitting the data to three parameter CP model
success = 0
p1 = p0
if len(thesecs)>=4:
p1, success = optimize.leastsq(errfunc, p0[:], args = (thesecs,theavpower))
else:
factor = fitfunc(p0,thesecs.mean())/theavpower.mean()
p1 = [p0[0]/factor,p0[1]/factor,p0[2],p0[3]]
success = 0
# Get stayer score

View File

@@ -1238,38 +1238,59 @@ class RowerForm(ModelForm):
try:
rest = self.cleaned_data['rest']
except:
rest = int(self.data['rest'])
try:
rest = int(self.data['rest'])
except ValueError:
rest = 0
try:
ut2 = self.cleaned_data['ut2']
except:
ut2 = self.data['ut2']
try:
ut2 = self.data['ut2']
except ValueError:
ut2 = 0
try:
ut1 = self.cleaned_data['ut1']
except:
ut1 = self.data['ut1']
try:
ut1 = self.data['ut1']
except ValueError:
ut1 = 0
try:
at = self.cleaned_data['at']
except:
at = self.data['at']
try:
at = self.data['at']
except ValueError:
at = 0
try:
an = self.cleaned_data['an']
except:
an = self.data['an']
try:
an = self.data['an']
except ValueError:
an = 0
try:
tr = self.cleaned_data['tr']
except:
tr = self.data['tr']
try:
tr = self.data['tr']
except ValueError:
tr = 0
try:
max = self.cleaned_data['max']
except:
max = self.data['max']
try:
max = self.data['max']
except ValueError:
max = 0
if rest>=ut2:
raise forms.ValidationError("Resting heart rate should be lower than UT2")
if ut2>=ut1:

View File

@@ -133,8 +133,7 @@
</td>
{% else %}
<td>
<a href={% url rower.defaultlandingpage
id=workout.id %}>No Name
<a href={% url rower.defaultlandingpage id=workout.id %}>No Name
</a></td>
{% endif %}
{% else %}

View File

@@ -3585,7 +3585,7 @@ def rankings_view2(request,theuser=0,
promember=0
if not request.user.is_anonymous():
r = getrower(theuser)
r = getrower(request.user)
wcdurations = []
wcpower = []
@@ -4129,7 +4129,7 @@ def otwrankings_view(request,theuser=0,
request.session['async_tasks'] += [(job.id,'updatecpwater')]
except KeyError:
request.session['async_tasks'] = [(job.id,'updatecpwater')]
messages.info(request,'New calculation queued. Refresh page or resubmit the date form to get the result')
messages.info(request,'New calculation queued. Page will reload automatically. You can check the status of your calculations <a href="/rowers/jobs-status/" target="_blank">here</a>')
powerdf = pd.DataFrame({
'Delta':delta,
@@ -4137,7 +4137,7 @@ def otwrankings_view(request,theuser=0,
})
if powerdf.empty:
messages.info(request,'Your calculations are running in the background. Please reload this page.')
messages.info(request,'Your calculations are running in the background. Page will reload automatically. You can check the status of your calculations <a href="/rowers/jobs-status/" target="_blank">here</a>')
powerdf = powerdf[powerdf['CP']>0]
powerdf.dropna(axis=0,inplace=True)
@@ -4383,7 +4383,7 @@ def oterankings_view(request,theuser=0,
request.session['async_tasks'] += [(job.id,'updatecp')]
except KeyError:
request.session['async_tasks'] = [(job.id,'updatecp')]
messages.info(request,'New calculation queued.')
messages.info(request,'New calculation queued. Page will reload automatically. You can check the status of your calculations <a href="/rowers/jobs-status/" target="_blank">here</a>')
powerdf = pd.DataFrame({
'Delta':delta,
@@ -4391,7 +4391,7 @@ def oterankings_view(request,theuser=0,
})
if powerdf.empty:
messages.info(request,'Your calculations are running in the background. Please reload this page.')
messages.info(request,'Your calculations are running in the background. Page will reload automatically. You can check the status of your calculations <a href="/rowers/jobs-status/" target="_blank">here</a>')
powerdf = powerdf[powerdf['CP']>0]
powerdf.dropna(axis=0,inplace=True)
@@ -6884,7 +6884,7 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
except KeyError:
request.session['async_tasks'] = [(job.id,'otwsetpower')]
successmessage = 'Your calculations have been submitted. You will receive an email when they are done. You can check the status of your calculations <a href="/rowers/jobs-status/">here</a>'
successmessage = 'Your calculations have been submitted. You will receive an email when they are done. You can check the status of your calculations <a href="/rowers/jobs-status/" target="_blank">here</a>'
messages.info(request,successmessage)
kwargs = {
'id':int(id)}
@@ -10182,7 +10182,13 @@ def workout_split_view(request,id=id):
else:
url = reverse(workouts_view)
qdict = {'q':row.name}
rowname = row.name
if isinstance(rowname,unicode):
rowname = rowname.encode('utf8')
elif isinstance(rowname, str):
rowname = rowname.decode('utf8')
qdict = {'q':rowname}
url+='?'+urllib.urlencode(qdict)
return HttpResponseRedirect(url)