Fixed Ranking distances
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -186,7 +186,7 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
|
|||||||
velo = thedistances/thesecs
|
velo = thedistances/thesecs
|
||||||
p = pd.Series(500./velo)
|
p = pd.Series(500./velo)
|
||||||
|
|
||||||
p2 = p.fillna(method='ffil').apply(lambda x: timedeltaconv(x))
|
p2 = p.fillna(method='ffill').apply(lambda x: timedeltaconv(x))
|
||||||
|
|
||||||
source = ColumnDataSource(
|
source = ColumnDataSource(
|
||||||
data = dict(
|
data = dict(
|
||||||
@@ -198,7 +198,7 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
|
|||||||
),
|
),
|
||||||
|
|
||||||
power = theavpower,
|
power = theavpower,
|
||||||
pace = nicepaceformat(p2),
|
fpace = nicepaceformat(p2),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -228,7 +228,7 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
|
|||||||
tim = niceformat(
|
tim = niceformat(
|
||||||
fitt.fillna(method='ffill').apply(lambda x: timedeltaconv(x))
|
fitt.fillna(method='ffill').apply(lambda x: timedeltaconv(x))
|
||||||
),
|
),
|
||||||
pace = nicepaceformat(fitp2),
|
fpace = nicepaceformat(fitp2),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ def interactive_cpchart(thedistances,thesecs,theavpower,
|
|||||||
),
|
),
|
||||||
spm = 0*fitpower,
|
spm = 0*fitpower,
|
||||||
power = fitpower,
|
power = fitpower,
|
||||||
pace = nicepaceformat(fitp2),
|
fpace = nicepaceformat(fitp2),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -170,7 +170,7 @@
|
|||||||
<td> {{ value }} W </td>
|
<td> {{ value }} W </td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if key == "duration" %}
|
{% if key == "duration" %}
|
||||||
<td> {{ value |paceprint }} </td>
|
<td> {{ value |deltatimeprint }} </td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
@@ -209,7 +209,7 @@
|
|||||||
<td> {{ value }} W </td>
|
<td> {{ value }} W </td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if key == "duration" %}
|
{% if key == "duration" %}
|
||||||
<td> {{ value |paceprint }} </td>
|
<td> {{ value |deltatimeprint }} </td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -6,7 +6,20 @@ register = template.Library()
|
|||||||
def strfdelta(tdelta):
|
def strfdelta(tdelta):
|
||||||
minutes,seconds = divmod(tdelta.seconds,60)
|
minutes,seconds = divmod(tdelta.seconds,60)
|
||||||
tenths = int(tdelta.microseconds/1e5)
|
tenths = int(tdelta.microseconds/1e5)
|
||||||
res = "{minutes:0>2}:{seconds:0>2}.{tenths:0>1}".format(
|
res = "{minutes:0>1}:{seconds:0>2}.{tenths:0>1}".format(
|
||||||
|
minutes=minutes,
|
||||||
|
seconds=seconds,
|
||||||
|
tenths=tenths,
|
||||||
|
)
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
def strfdeltah(tdelta):
|
||||||
|
hours, rest = divmod(tdelta.seconds,3600)
|
||||||
|
minutes,seconds = divmod(rest,60)
|
||||||
|
tenths = int(tdelta.microseconds/1e5)
|
||||||
|
res = "{hours:0>2}:{minutes:0>2}:{seconds:0>2}.{tenths:0>1}".format(
|
||||||
|
hours=hours,
|
||||||
minutes=minutes,
|
minutes=minutes,
|
||||||
seconds=seconds,
|
seconds=seconds,
|
||||||
tenths=tenths,
|
tenths=tenths,
|
||||||
@@ -28,6 +41,13 @@ def paceprint(d):
|
|||||||
else:
|
else:
|
||||||
return strfdelta(d)
|
return strfdelta(d)
|
||||||
|
|
||||||
|
@register.filter
|
||||||
|
def deltatimeprint(d):
|
||||||
|
if (d == None):
|
||||||
|
return d
|
||||||
|
else:
|
||||||
|
return strfdeltah(d)
|
||||||
|
|
||||||
|
|
||||||
@register.filter
|
@register.filter
|
||||||
def lookup(dict, key):
|
def lookup(dict, key):
|
||||||
|
|||||||
@@ -66,6 +66,7 @@ import mailprocessing
|
|||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
from scipy.special import lambertw
|
from scipy.special import lambertw
|
||||||
|
|
||||||
|
from dataprep import timedeltaconv
|
||||||
|
|
||||||
LOCALTIMEZONE = tz('Etc/UTC')
|
LOCALTIMEZONE = tz('Etc/UTC')
|
||||||
USER_LANGUAGE = 'en-US'
|
USER_LANGUAGE = 'en-US'
|
||||||
@@ -1617,8 +1618,8 @@ def rankings_view(request,theuser=0,
|
|||||||
t = rankingdistance/velo
|
t = rankingdistance/velo
|
||||||
pwr = 2.8*(velo**3)
|
pwr = 2.8*(velo**3)
|
||||||
a = {'distance':rankingdistance,
|
a = {'distance':rankingdistance,
|
||||||
'duration':get_datetimes([t])[0],
|
'duration':timedeltaconv(t),
|
||||||
'pace':get_datetimes([p])[0],
|
'pace':timedeltaconv(p),
|
||||||
'power':int(pwr)}
|
'power':int(pwr)}
|
||||||
predictions.append(a)
|
predictions.append(a)
|
||||||
|
|
||||||
@@ -1650,8 +1651,8 @@ def rankings_view(request,theuser=0,
|
|||||||
p3 = 500./velo3
|
p3 = 500./velo3
|
||||||
|
|
||||||
a = {'distance':rankingdistance,
|
a = {'distance':rankingdistance,
|
||||||
'duration':get_datetimes([t3])[0],
|
'duration':timedeltaconv(t3),
|
||||||
'pace':get_datetimes([p3])[0],
|
'pace':timedeltaconv(p3),
|
||||||
'power':int(pwr3)}
|
'power':int(pwr3)}
|
||||||
cpredictions.append(a)
|
cpredictions.append(a)
|
||||||
|
|
||||||
@@ -1677,8 +1678,8 @@ def rankings_view(request,theuser=0,
|
|||||||
p = 500./velo
|
p = 500./velo
|
||||||
pwr = 2.8*(velo**3)
|
pwr = 2.8*(velo**3)
|
||||||
a = {'distance':int(d),
|
a = {'distance':int(d),
|
||||||
'duration':get_datetimes([t])[0],
|
'duration':timedeltaconv(t),
|
||||||
'pace':get_datetimes([p])[0],
|
'pace':timedeltaconv(p),
|
||||||
'power':int(pwr)}
|
'power':int(pwr)}
|
||||||
predictions.append(a)
|
predictions.append(a)
|
||||||
|
|
||||||
@@ -1697,8 +1698,8 @@ def rankings_view(request,theuser=0,
|
|||||||
d = t*velo
|
d = t*velo
|
||||||
p = 500./velo
|
p = 500./velo
|
||||||
a = {'distance':int(d),
|
a = {'distance':int(d),
|
||||||
'duration':get_datetimes([t])[0],
|
'duration':timedeltaconv(t),
|
||||||
'pace':get_datetimes([p])[0],
|
'pace':timedeltaconv(p),
|
||||||
'power':int(pwr)}
|
'power':int(pwr)}
|
||||||
cpredictions.append(a)
|
cpredictions.append(a)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user