strava style chart v 1
This commit is contained in:
@@ -1518,6 +1518,7 @@ class VirtualRaceSelectForm(forms.Form):
|
||||
choices = get_countries(),initial='All'
|
||||
)
|
||||
|
||||
|
||||
class FlexOptionsForm(forms.Form):
|
||||
includereststrokes = forms.BooleanField(initial=True, required = False,
|
||||
label='Include Rest Strokes')
|
||||
@@ -1540,24 +1541,80 @@ class ForceCurveOptionsForm(forms.Form):
|
||||
label='Individual Stroke Chart Type')
|
||||
|
||||
|
||||
axchoices = list(
|
||||
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','None']
|
||||
)
|
||||
axchoices = dict((x,y) for x,y in axchoices)
|
||||
axchoices = list(sorted(axchoices.items(), key = lambda x:x[1]))
|
||||
|
||||
|
||||
yaxchoices = list((ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time'])
|
||||
yaxchoices = dict((x,y) for x,y in yaxchoices)
|
||||
yaxchoices = list(sorted(yaxchoices.items(), key = lambda x:x[1]))
|
||||
|
||||
|
||||
yaxchoices2 = list(
|
||||
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time']
|
||||
)
|
||||
yaxchoices2 = dict((x,y) for x,y in yaxchoices2)
|
||||
yaxchoices2 = list(sorted(yaxchoices2.items(), key = lambda x:x[1]))
|
||||
|
||||
class StravaChartForm(forms.Form):
|
||||
xaxischoices = (
|
||||
('cumdist','Distance'),
|
||||
('time','Time')
|
||||
)
|
||||
|
||||
xaxis = forms.ChoiceField(
|
||||
choices = xaxischoices,label='X-Axis',required=True)
|
||||
|
||||
|
||||
yaxis1 = forms.ChoiceField(
|
||||
choices=yaxchoices,label='First Chart',required=True)
|
||||
yaxis2 = forms.ChoiceField(
|
||||
choices=yaxchoices2,label='Second Chart',required=True)
|
||||
|
||||
yaxis3 = forms.ChoiceField(
|
||||
choices=yaxchoices,label='Third Chart',required=True)
|
||||
yaxis4 = forms.ChoiceField(
|
||||
choices=yaxchoices2,label='Fourth Chart',required=True)
|
||||
|
||||
def __init__(self,request,*args,**kwargs):
|
||||
extrametrics = kwargs.pop('extrametrics',[])
|
||||
super(StravaChartForm, self).__init__(*args, **kwargs)
|
||||
|
||||
|
||||
rower = Rower.objects.get(user=request.user)
|
||||
|
||||
axchoicespro = (
|
||||
('',ax[1]) if ax[4] == 'pro' and ax[0] else (ax[0],ax[1]) for ax in axes
|
||||
)
|
||||
|
||||
axchoicesbasicx = []
|
||||
axchoicesbasicy = []
|
||||
|
||||
for ax in axes:
|
||||
if ax[4] != 'pro' and ax[0] != 'cumdist':
|
||||
if ax[0] != 'None':
|
||||
axchoicesbasicx.insert(0,(ax[0],ax[1]))
|
||||
if ax[0] not in ['cumdist','distance','time']:
|
||||
axchoicesbasicy.insert(0,(ax[0],ax[1]))
|
||||
else:
|
||||
if ax[0] != 'None':
|
||||
axchoicesbasicx.insert(0,('None',ax[1]+' (PRO)'))
|
||||
if ax[0] not in ['cumdist','distance','time']:
|
||||
axchoicesbasicy.insert(0,('None',ax[1]+' (PRO)'))
|
||||
|
||||
|
||||
if not user_is_not_basic(rower.user):
|
||||
self.fields['xaxis'].choices = axchoicesbasicx
|
||||
self.fields['yaxis1'].choices = axchoicesbasicy
|
||||
self.fields['yaxis2'].choices = axchoicesbasicy
|
||||
self.fields['yaxis3'].choices = axchoicesbasicy
|
||||
self.fields['yaxis4'].choices = axchoicesbasicy
|
||||
|
||||
|
||||
class FlexAxesForm(forms.Form):
|
||||
axchoices = list(
|
||||
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','None']
|
||||
)
|
||||
axchoices = dict((x,y) for x,y in axchoices)
|
||||
axchoices = list(sorted(axchoices.items(), key = lambda x:x[1]))
|
||||
|
||||
|
||||
yaxchoices = list((ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time'])
|
||||
yaxchoices = dict((x,y) for x,y in yaxchoices)
|
||||
yaxchoices = list(sorted(yaxchoices.items(), key = lambda x:x[1]))
|
||||
|
||||
|
||||
yaxchoices2 = list(
|
||||
(ax[0],ax[1]) for ax in axes if ax[0] not in ['cumdist','distance','time']
|
||||
)
|
||||
yaxchoices2 = dict((x,y) for x,y in yaxchoices2)
|
||||
yaxchoices2 = list(sorted(yaxchoices2.items(), key = lambda x:x[1]))
|
||||
|
||||
xaxis = forms.ChoiceField(
|
||||
choices=axchoices,label='X-Axis',required=True)
|
||||
|
||||
Reference in New Issue
Block a user