Merge branch 'release/v20.1.13'
This commit is contained in:
@@ -1870,6 +1870,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
plot = figure(tools=TOOLS, x_axis_type='datetime',
|
||||
width=900, height=300,
|
||||
toolbar_location="above",
|
||||
@@ -1898,6 +1899,15 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
y_range_name="watermark",
|
||||
)
|
||||
|
||||
fitlabel = 'Fitness'
|
||||
fatiguelabel = 'Fatigue'
|
||||
formlabel = 'Freshness'
|
||||
rightaxlabel = 'Freshness'
|
||||
if dofatigue: # pragma: no cover
|
||||
yaxlabel = 'Fitness/Fatigue'
|
||||
else:
|
||||
yaxlabel = 'Fitness'
|
||||
|
||||
if modelchoice == 'banister': # pragma: no cover
|
||||
fitlabel = 'PTE (fitness)'
|
||||
fatiguelabel = 'NTE (fatigue)'
|
||||
@@ -1907,31 +1917,14 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
yaxlabel = 'PTE/NTE'
|
||||
else:
|
||||
yaxlabel = 'PTE'
|
||||
else:
|
||||
fitlabel = 'Fitness'
|
||||
fatiguelabel = 'Fatigue'
|
||||
formlabel = 'Freshness'
|
||||
rightaxlabel = 'Freshness'
|
||||
if dofatigue: # pragma: no cover
|
||||
yaxlabel = 'Fitness/Fatigue'
|
||||
else:
|
||||
yaxlabel = 'Fitness'
|
||||
|
||||
# if showtests:
|
||||
# plot.circle('date','testpower',source=source,fill_color='green',size=10,
|
||||
# legend_label='Your best workouts')
|
||||
|
||||
plot.xaxis.axis_label = None
|
||||
plot.yaxis.axis_label = yaxlabel
|
||||
|
||||
y2rangemin = df.loc[:, ['form']].min().min()
|
||||
y2rangemax = df.loc[:, ['form']].max().max()
|
||||
# if dofatigue and showtests:
|
||||
# y1rangemin = df.loc[:,['testpower','fitness','fatigue']].min().min()
|
||||
# y1rangemax = df.loc[:,['testpower','fitness','fatigue']].max().max()*1.02
|
||||
# elif showtests:
|
||||
# y1rangemin = df.loc[:,['testpower','fitness']].min().min()
|
||||
# y1rangemax = df.loc[:,['testpower','fitness']].max().max()*1.02
|
||||
|
||||
if dofatigue: # pragma: no cover
|
||||
y1rangemax = df.loc[:, ['fitness', 'fatigue']].max().max()*1.02
|
||||
else:
|
||||
@@ -1940,7 +1933,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
if doform: # pragma: no cover
|
||||
plot.extra_y_ranges["yax2"] = Range1d(start=y2rangemin, end=y2rangemax)
|
||||
plot.add_layout(LinearAxis(y_range_name="yax2",
|
||||
axis_label=rightaxlabel), "right")
|
||||
axis_label=rightaxlabel), "right")
|
||||
|
||||
plot.line('date', 'fitness', source=source, color='blue',
|
||||
legend_label=fitlabel)
|
||||
@@ -1957,7 +1950,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
|
||||
plot.legend.location = "top_left"
|
||||
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
startdate = datetime.datetime.combine(
|
||||
startdate, datetime.datetime.min.time())
|
||||
@@ -1977,7 +1970,6 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
linked_crosshair = CrosshairTool(dimensions='height')
|
||||
|
||||
hover.tooltips = OrderedDict([
|
||||
# (legend_label,'@testpower'),
|
||||
('Date', '@fdate'),
|
||||
(fitlabel, '@fitness{int}'),
|
||||
(fatiguelabel, '@fatigue{int}'),
|
||||
@@ -1987,7 +1979,6 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
|
||||
if showtests:
|
||||
hover.tooltips = OrderedDict([
|
||||
# (legend_label,'@testpower'),
|
||||
('Date', '@fdate'),
|
||||
(fitlabel, '@fitness{int}'),
|
||||
(fatiguelabel, '@fatigue{int}'),
|
||||
@@ -2008,7 +1999,7 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
plot2.vbar(x=df['date'], top=df['impulse'], color='gray')
|
||||
plot2.vbar(x=df['date'], top=0*df['testpower']+df['impulse'], color='red')
|
||||
|
||||
plot2.sizing_mode = 'scale_both'
|
||||
#plot2.sizing_mode = 'scale_both'
|
||||
plot2.yaxis.axis_label = 'Impulse'
|
||||
plot2.xaxis.axis_label = 'Date'
|
||||
|
||||
@@ -2016,7 +2007,6 @@ def performance_chart(user, startdate=None, enddate=None, kfitness=42, kfatigue=
|
||||
plot2.add_tools(linked_crosshair)
|
||||
|
||||
mylayout = layoutcolumn([plot, plot2])
|
||||
#mylayout.sizing_mode = 'stretch_both'
|
||||
|
||||
try:
|
||||
script, div = components(mylayout)
|
||||
@@ -3566,7 +3556,7 @@ def interactive_otwcpchart(powerdf, promember=0, rowername="", r=None,
|
||||
watermarkh = 35
|
||||
watermarkanchor = 'bottom_right'
|
||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
plot.image_url([watermarkurl], 1.8*max(thesecs), watermarky,
|
||||
watermarkw, watermarkh,
|
||||
@@ -3895,7 +3885,7 @@ def interactive_cpchart(rower, thedistances, thesecs, theavpower,
|
||||
watermarkh = 35
|
||||
watermarkanchor = 'bottom_right'
|
||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
plot.image_url([watermarkurl], 1.8*max(thesecs), watermarky,
|
||||
watermarkw, watermarkh,
|
||||
@@ -6838,7 +6828,7 @@ def interactive_otw_advanced_pace_chart(id=0, promember=0):
|
||||
watermarkanchor = 'bottom_right'
|
||||
plot.extra_y_ranges = {"watermark": watermarkrange}
|
||||
plot.extra_x_ranges = {"watermark": watermarkrange}
|
||||
plot.sizing_mode = 'scale_both'
|
||||
#plot.sizing_mode = 'scale_both'
|
||||
|
||||
plot.image_url([watermarkurl], watermarkx, watermarky,
|
||||
watermarkw, watermarkh,
|
||||
|
||||
@@ -11,52 +11,53 @@
|
||||
<script>
|
||||
|
||||
function submit_form() {
|
||||
console.log("form changed");
|
||||
var frm = $("#performanceform");
|
||||
|
||||
var data = new FormData(frm[0]);
|
||||
|
||||
$.ajax({
|
||||
url:"/rowers/performancemanager/user/{{ rower.user.id }}/",
|
||||
type: "POST",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
|
||||
success: function(data) {
|
||||
console.log(data);
|
||||
// var parsedJSON = $.parseJSON(data); //
|
||||
$("#id_script").replaceWith('<div id="id_script">'+data.script+'</d'+'iv>');
|
||||
$("#id_chart").replaceWith('<div id="id_chart">'+data.div+'</d'+'iv>');
|
||||
$("#endfitness").html(data.endfitness)
|
||||
$("#endfatigue").html(data.endfatigue)
|
||||
$("#endform").html(data.endform)
|
||||
console.log('done');
|
||||
}
|
||||
});
|
||||
};
|
||||
console.log("form changed");
|
||||
var frm = $("#performanceform");
|
||||
|
||||
var data = new FormData(frm[0]);
|
||||
|
||||
$.ajax({
|
||||
url:"/rowers/performancemanager/user/{{ rower.user.id }}/",
|
||||
type: "POST",
|
||||
contentType: false,
|
||||
processData: false,
|
||||
data: data,
|
||||
dataType: 'json',
|
||||
|
||||
success: function(data) {
|
||||
console.log(data.div);
|
||||
|
||||
// var parsedJSON = $.parseJSON(data); //
|
||||
$("#id_script").replaceWith('<div id="id_script">'+data.script+'</d'+'iv>');
|
||||
$("#id_chart").replaceWith('<div id="id_chart">'+data.div+'</d'+'iv>');
|
||||
$("#endfitness").html(data.endfitness)
|
||||
$("#endfatigue").html(data.endfatigue)
|
||||
$("#endform").html(data.endform)
|
||||
console.log('done');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
|
||||
console.log("CSRF token",csrftoken);
|
||||
|
||||
function csrfSafeMethod(method) {
|
||||
// these HTTP methods do not require CSRF protection
|
||||
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
||||
}
|
||||
$.ajaxSetup({
|
||||
beforeSend: function(xhr, settings) {
|
||||
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
||||
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||
}
|
||||
}
|
||||
var csrftoken = jQuery("[name=csrfmiddlewaretoken]").val();
|
||||
console.log("CSRF token",csrftoken);
|
||||
|
||||
function csrfSafeMethod(method) {
|
||||
// these HTTP methods do not require CSRF protection
|
||||
return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
|
||||
}
|
||||
$.ajaxSetup({
|
||||
beforeSend: function(xhr, settings) {
|
||||
if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
|
||||
xhr.setRequestHeader("X-CSRFToken", csrftoken);
|
||||
}
|
||||
}
|
||||
});
|
||||
$("#performanceform").on('change', function(evt) {
|
||||
submit_form();
|
||||
});
|
||||
});
|
||||
$("#performanceform").on('change', function(evt) {
|
||||
submit_form();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user