Merge branch 'release/v18.6.19'
This commit is contained in:
+16
-2
@@ -100,8 +100,22 @@ def alert_get_stats(alert, nperiod=0): # pragma: no cover
|
|||||||
boattype=alert.boattype)
|
boattype=alert.boattype)
|
||||||
ids = [w.id for w in workouts]
|
ids = [w.id for w in workouts]
|
||||||
|
|
||||||
df = getsmallrowdata_db(columns, ids=ids, doclean=True,
|
try:
|
||||||
workstrokesonly=workstrokesonly)
|
df = getsmallrowdata_db(columns, ids=ids, doclean=True,
|
||||||
|
workstrokesonly=workstrokesonly)
|
||||||
|
except:
|
||||||
|
return {
|
||||||
|
'workouts': workouts.count(),
|
||||||
|
'startdate': startdate,
|
||||||
|
'enddate': enddate,
|
||||||
|
'nr_strokes': 0,
|
||||||
|
'nr_strokes_qualifying': 0,
|
||||||
|
'percentage': 0,
|
||||||
|
'nperiod': nperiod,
|
||||||
|
'median': 0,
|
||||||
|
'median_q': 0,
|
||||||
|
'standard_dev': 0,
|
||||||
|
}
|
||||||
|
|
||||||
if df.empty:
|
if df.empty:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -1246,8 +1246,11 @@ def getsmallrowdata_db(columns, ids=[], doclean=True, workstrokesonly=True, comp
|
|||||||
if rowdata and len(rowdata.df):
|
if rowdata and len(rowdata.df):
|
||||||
_ = dataprep(rowdata.df, id=id,
|
_ = dataprep(rowdata.df, id=id,
|
||||||
bands=True, otwpower=True, barchart=True)
|
bands=True, otwpower=True, barchart=True)
|
||||||
df = pd.read_parquet(f, columns=columns)
|
try:
|
||||||
data.append(df)
|
df = pd.read_parquet(f, columns=columns)
|
||||||
|
data.append(df)
|
||||||
|
except (OSError, ArrowInvalid, IndexError):
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
df = pd.concat(data, axis=0)
|
df = pd.concat(data, axis=0)
|
||||||
|
|||||||
@@ -365,6 +365,9 @@ def interactive_boxchart(datadf, fieldname, extratitle='',
|
|||||||
plot.y_range = yrange1
|
plot.y_range = yrange1
|
||||||
plot.sizing_mode = 'stretch_both'
|
plot.sizing_mode = 'stretch_both'
|
||||||
|
|
||||||
|
if extratitle:
|
||||||
|
plot.title.text = extratitle
|
||||||
|
|
||||||
plot.xaxis.axis_label = 'Date'
|
plot.xaxis.axis_label = 'Date'
|
||||||
plot.yaxis.axis_label = axlabels[fieldname]
|
plot.yaxis.axis_label = axlabels[fieldname]
|
||||||
|
|
||||||
@@ -1970,6 +1973,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
|||||||
|
|
||||||
def interactive_histoall(theworkouts, histoparam, includereststrokes,
|
def interactive_histoall(theworkouts, histoparam, includereststrokes,
|
||||||
spmmin=0, spmmax=55,
|
spmmin=0, spmmax=55,
|
||||||
|
extratitle='',
|
||||||
workmin=0, workmax=1500):
|
workmin=0, workmax=1500):
|
||||||
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
|
TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,crosshair'
|
||||||
|
|
||||||
@@ -2013,6 +2017,10 @@ def interactive_histoall(theworkouts, histoparam, includereststrokes,
|
|||||||
toolbar_location="above"
|
toolbar_location="above"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if extratitle:
|
||||||
|
plot.title.text = extratitle
|
||||||
|
|
||||||
|
|
||||||
# add watermark
|
# add watermark
|
||||||
watermarkurl = "/static/img/logo7.png"
|
watermarkurl = "/static/img/logo7.png"
|
||||||
watermarkrange = Range1d(start=0, end=1)
|
watermarkrange = Range1d(start=0, end=1)
|
||||||
@@ -4470,6 +4478,9 @@ def interactive_multiflex(datadf, xparam, yparam, groupby, extratitle='',
|
|||||||
gr=groupname,
|
gr=groupname,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if extratitle is not None:
|
||||||
|
title = title+' '+extratitle
|
||||||
|
|
||||||
if xparam == 'cumdist': # pragma: no cover
|
if xparam == 'cumdist': # pragma: no cover
|
||||||
res = make_cumvalues(datadf[xparam])
|
res = make_cumvalues(datadf[xparam])
|
||||||
datadf[xparam] = res[0]
|
datadf[xparam] = res[0]
|
||||||
@@ -4659,6 +4670,7 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
|
|||||||
yparam1='power',
|
yparam1='power',
|
||||||
yparam2='spm',
|
yparam2='spm',
|
||||||
workstrokesonly=False,
|
workstrokesonly=False,
|
||||||
|
extratitle='',
|
||||||
trendline=False):
|
trendline=False):
|
||||||
|
|
||||||
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
|
# datadf = dataprep.smalldataprep(theworkouts,xparam,yparam1,yparam2)
|
||||||
@@ -4789,6 +4801,10 @@ def interactive_cum_flex_chart2(theworkouts, promember=0,
|
|||||||
plot.extra_x_ranges = {"watermark": watermarkrange}
|
plot.extra_x_ranges = {"watermark": watermarkrange}
|
||||||
plot.sizing_mode = 'stretch_both'
|
plot.sizing_mode = 'stretch_both'
|
||||||
|
|
||||||
|
if extratitle:
|
||||||
|
plot.title.text = extratitle
|
||||||
|
|
||||||
|
|
||||||
plot.image_url([watermarkurl], watermarkx, watermarky,
|
plot.image_url([watermarkurl], watermarkx, watermarky,
|
||||||
watermarkw, watermarkh,
|
watermarkw, watermarkh,
|
||||||
global_alpha=watermarkalpha,
|
global_alpha=watermarkalpha,
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
{% if stats %}
|
{% if stats %}
|
||||||
<h2>Statistics</h2>
|
<h2>Statistics {{ extratitle }}</h2>
|
||||||
<table width="100%" class="listtable">
|
<table width="100%" class="listtable">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -67,10 +67,6 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -528,7 +528,7 @@
|
|||||||
<script>
|
<script>
|
||||||
$(function($) {
|
$(function($) {
|
||||||
console.log('loading script');
|
console.log('loading script');
|
||||||
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/analysisdata/', function(json) {
|
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/analysisdata/user/{{ rower.user.id }}', function(json) {
|
||||||
var counter=0;
|
var counter=0;
|
||||||
var script = json.script;
|
var script = json.script;
|
||||||
var div = json.div;
|
var div = json.div;
|
||||||
|
|||||||
@@ -69,6 +69,15 @@ class ChallengesTest(TestCase):
|
|||||||
gdproptindate=timezone.now(),
|
gdproptindate=timezone.now(),
|
||||||
rowerplan='basic')
|
rowerplan='basic')
|
||||||
|
|
||||||
|
self.u3 = UserFactory()
|
||||||
|
self.follower = Rower.objects.create(user=self.u3,
|
||||||
|
birthdate=datetime.datetime.now()-datetime.timedelta(days=28*365),
|
||||||
|
gdproptin=True,surveydone=True,
|
||||||
|
gdproptindate=timezone.now(),
|
||||||
|
rowerplan='basic')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.c = Client()
|
self.c = Client()
|
||||||
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
self.user_workouts = WorkoutFactory.create_batch(5, user=self.r)
|
||||||
self.factory = RequestFactory()
|
self.factory = RequestFactory()
|
||||||
@@ -160,6 +169,10 @@ class ChallengesTest(TestCase):
|
|||||||
)
|
)
|
||||||
self.SpeedOrder.save()
|
self.SpeedOrder.save()
|
||||||
|
|
||||||
|
flw = VirtualRaceFollower.objects.create(race=self.SpeedOrder,
|
||||||
|
user=self.u3,
|
||||||
|
emailaddress='bla@bla.com')
|
||||||
|
|
||||||
self.result = VirtualRaceResult(
|
self.result = VirtualRaceResult(
|
||||||
userid = self.u2.id,
|
userid = self.u2.id,
|
||||||
username = self.u2.username,
|
username = self.u2.username,
|
||||||
|
|||||||
@@ -419,6 +419,8 @@ urlpatterns = [
|
|||||||
re_path(r'^ote-bests2/user/(?P<userid>\d+)/$',
|
re_path(r'^ote-bests2/user/(?P<userid>\d+)/$',
|
||||||
views.rankings_view2, name='rankings_view2'),
|
views.rankings_view2, name='rankings_view2'),
|
||||||
re_path(r'^ote-bests2/$', views.rankings_view2, name='rankings_view2'),
|
re_path(r'^ote-bests2/$', views.rankings_view2, name='rankings_view2'),
|
||||||
|
re_path(r'^analysisdata/user/(?P<userid>\d+)/$', views.analysis_view_data,
|
||||||
|
name='analysis_view_data'),
|
||||||
re_path(r'^analysisdata/$', views.analysis_view_data,
|
re_path(r'^analysisdata/$', views.analysis_view_data,
|
||||||
name='analysis_view_data'),
|
name='analysis_view_data'),
|
||||||
re_path(r'^graph/(?P<id>\d+)/$',
|
re_path(r'^graph/(?P<id>\d+)/$',
|
||||||
|
|||||||
@@ -459,6 +459,7 @@ def trendflexdata(workouts, options, userid=0):
|
|||||||
u = User.objects.get(id=userid)
|
u = User.objects.get(id=userid)
|
||||||
extratitle = ' '+u.first_name+' '+u.last_name
|
extratitle = ' '+u.first_name+' '+u.last_name
|
||||||
|
|
||||||
|
|
||||||
script, div = interactive_multiflex(df, xparam, yparam,
|
script, div = interactive_multiflex(df, xparam, yparam,
|
||||||
groupby,
|
groupby,
|
||||||
extratitle=extratitle,
|
extratitle=extratitle,
|
||||||
@@ -484,10 +485,19 @@ def flexalldata(workouts, options):
|
|||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
|
userid = options['userid']
|
||||||
|
|
||||||
|
if userid == 0: # pragma: no cover
|
||||||
|
extratitle = ''
|
||||||
|
else:
|
||||||
|
u = User.objects.get(id=userid)
|
||||||
|
extratitle = ' '+u.first_name+' '+u.last_name
|
||||||
|
|
||||||
res = interactive_cum_flex_chart2(workouts, xparam=xparam,
|
res = interactive_cum_flex_chart2(workouts, xparam=xparam,
|
||||||
yparam1=yparam1,
|
yparam1=yparam1,
|
||||||
yparam2=yparam2,
|
yparam2=yparam2,
|
||||||
promember=promember,
|
promember=promember,
|
||||||
|
extratitle=extratitle,
|
||||||
workstrokesonly=workstrokesonly,
|
workstrokesonly=workstrokesonly,
|
||||||
trendline=trendline,
|
trendline=trendline,
|
||||||
)
|
)
|
||||||
@@ -507,9 +517,18 @@ def histodata(workouts, options):
|
|||||||
spmmax = options['spmmax']
|
spmmax = options['spmmax']
|
||||||
workmin = options['workmin']
|
workmin = options['workmin']
|
||||||
workmax = options['workmax']
|
workmax = options['workmax']
|
||||||
|
userid = options['userid']
|
||||||
|
|
||||||
|
if userid == 0: # pragma: no cover
|
||||||
|
extratitle = ''
|
||||||
|
else:
|
||||||
|
u = User.objects.get(id=userid)
|
||||||
|
extratitle = ' '+u.first_name+' '+u.last_name
|
||||||
|
|
||||||
|
|
||||||
script, div = interactive_histoall(workouts, plotfield, includereststrokes,
|
script, div = interactive_histoall(workouts, plotfield, includereststrokes,
|
||||||
spmmin=spmmin, spmmax=spmmax,
|
spmmin=spmmin, spmmax=spmmax,
|
||||||
|
extratitle=extratitle,
|
||||||
workmin=workmin, workmax=workmax)
|
workmin=workmin, workmax=workmax)
|
||||||
|
|
||||||
scripta = script.split('\n')[2:-1]
|
scripta = script.split('\n')[2:-1]
|
||||||
@@ -675,6 +694,14 @@ def statsdata(workouts, options):
|
|||||||
includereststrokes = options['includereststrokes']
|
includereststrokes = options['includereststrokes']
|
||||||
ids = options['ids']
|
ids = options['ids']
|
||||||
|
|
||||||
|
userid = options['userid']
|
||||||
|
|
||||||
|
if userid == 0: # pragma: no cover
|
||||||
|
extratitle = ''
|
||||||
|
else:
|
||||||
|
u = User.objects.get(id=userid)
|
||||||
|
extratitle = ' '+u.first_name+' '+u.last_name
|
||||||
|
|
||||||
workstrokesonly = not includereststrokes
|
workstrokesonly = not includereststrokes
|
||||||
|
|
||||||
ids = [w.id for w in workouts]
|
ids = [w.id for w in workouts]
|
||||||
@@ -728,6 +755,7 @@ def statsdata(workouts, options):
|
|||||||
context = {
|
context = {
|
||||||
'stats': stats,
|
'stats': stats,
|
||||||
'cordict': cordict,
|
'cordict': cordict,
|
||||||
|
'extratitle': extratitle,
|
||||||
}
|
}
|
||||||
|
|
||||||
htmly = env.get_template('statsdiv.html')
|
htmly = env.get_template('statsdiv.html')
|
||||||
|
|||||||
@@ -1873,6 +1873,8 @@ def virtualevent_addboat_view(request, id=0):
|
|||||||
otherrecords = resultobj.objects.filter(
|
otherrecords = resultobj.objects.filter(
|
||||||
race=race).exclude(userid=r.id)
|
race=race).exclude(userid=r.id)
|
||||||
|
|
||||||
|
registereduserids = [otherrecord.userid for otherrecord in otherrecords]
|
||||||
|
|
||||||
for otherrecord in otherrecords:
|
for otherrecord in otherrecords:
|
||||||
try:
|
try:
|
||||||
otheruser = Rower.objects.get(id=otherrecord.userid)
|
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||||
@@ -1892,19 +1894,20 @@ def virtualevent_addboat_view(request, id=0):
|
|||||||
|
|
||||||
followers = VirtualRaceFollower.objects.filter(race=race)
|
followers = VirtualRaceFollower.objects.filter(race=race)
|
||||||
|
|
||||||
for follower in followers: # pragma: no cover
|
for follower in followers:
|
||||||
othername = ''
|
othername = ''
|
||||||
if follower.user:
|
if follower.user:
|
||||||
othername = follower.user.first_name+' '+follower.user.last_name
|
othername = follower.user.first_name+' '+follower.user.last_name
|
||||||
|
|
||||||
registeredname = r.user.first_name+' '+r.user.last_name
|
registeredname = r.user.first_name+' '+r.user.last_name
|
||||||
email = follower.emailaddress
|
email = follower.emailaddress
|
||||||
_ = myqueue(
|
if follower.user.id not in registereduserids:
|
||||||
queue,
|
_ = myqueue(
|
||||||
handle_sendemail_raceregistration,
|
queue,
|
||||||
email, othername,
|
handle_sendemail_raceregistration,
|
||||||
registeredname, race.name, race.id,
|
email, othername,
|
||||||
)
|
registeredname, race.name, race.id,
|
||||||
|
)
|
||||||
|
|
||||||
url = reverse('virtualevent_view',
|
url = reverse('virtualevent_view',
|
||||||
kwargs={
|
kwargs={
|
||||||
|
|||||||
Reference in New Issue
Block a user