making test for box chart
This commit is contained in:
@@ -7312,6 +7312,11 @@ def boxplot_view_data(request,userid=0,
|
||||
|
||||
workouts = []
|
||||
|
||||
if not ids:
|
||||
return JSONResponse({
|
||||
"script":'',
|
||||
"div":'No data found'
|
||||
})
|
||||
|
||||
for id in ids:
|
||||
try:
|
||||
@@ -7336,6 +7341,7 @@ def boxplot_view_data(request,userid=0,
|
||||
|
||||
# prepare data frame
|
||||
datadf,extracols = dataprep.read_cols_df_sql(ids,fieldlist)
|
||||
|
||||
|
||||
datadf = dataprep.clean_df_stats(datadf,workstrokesonly=workstrokesonly)
|
||||
|
||||
@@ -7350,6 +7356,7 @@ def boxplot_view_data(request,userid=0,
|
||||
|
||||
datadf.dropna(axis=0,how='any',inplace=True)
|
||||
|
||||
|
||||
datadf['workoutid'].replace(datemapping,inplace=True)
|
||||
datadf.rename(columns={"workoutid":"date"},inplace=True)
|
||||
datadf = datadf.sort_values(['date'])
|
||||
@@ -7385,6 +7392,8 @@ def boxplot_view(request,userid=0,
|
||||
|
||||
if 'options' in request.session:
|
||||
options = request.session['options']
|
||||
else:
|
||||
options = {}
|
||||
|
||||
try:
|
||||
includereststrokes = options['includereststrokes']
|
||||
@@ -7402,7 +7411,8 @@ def boxplot_view(request,userid=0,
|
||||
|
||||
if userid==0:
|
||||
userid = request.user.id
|
||||
|
||||
|
||||
|
||||
if request.method == 'POST' and 'workouts' in request.POST:
|
||||
form = WorkoutMultipleCompareForm(request.POST)
|
||||
chartform = BoxPlotChoiceForm(request.POST)
|
||||
@@ -7423,7 +7433,8 @@ def boxplot_view(request,userid=0,
|
||||
request.session['ids'] = ids
|
||||
|
||||
else:
|
||||
return HttpResponse("Form is not valid")
|
||||
url = reverse(user_boxplot_select,kwargs={'userid':userid})
|
||||
return HttpResponseRedirect(url)
|
||||
elif request.method == 'POST' and 'ids' in request.session:
|
||||
chartform = BoxPlotChoiceForm(request.POST)
|
||||
if chartform.is_valid():
|
||||
@@ -7440,13 +7451,15 @@ def boxplot_view(request,userid=0,
|
||||
|
||||
|
||||
else:
|
||||
return HttpResponse("invalid form")
|
||||
url = reverse(user_boxplot_select,kwargs={'userid':userid})
|
||||
return HttpResponseRedirect(url)
|
||||
else:
|
||||
url = reverse(user_boxplot_select,kwargs={'userid':userid})
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
div = get_call()
|
||||
|
||||
|
||||
options['spmmin'] = spmmin
|
||||
options['spmmax'] = spmmax
|
||||
options['workmin'] = workmin
|
||||
@@ -7456,8 +7469,9 @@ def boxplot_view(request,userid=0,
|
||||
options['plotfield'] = plotfield
|
||||
options['rankingonly'] = rankingonly
|
||||
|
||||
|
||||
request.session['options'] = options
|
||||
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
breadcrumbs = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user