added buttons to fusion
This commit is contained in:
@@ -6,6 +6,8 @@ from django.contrib.auth.models import User
|
||||
from django.contrib.admin.widgets import AdminDateWidget
|
||||
from django.forms.extras.widgets import SelectDateWidget
|
||||
from django.utils import timezone,translation
|
||||
from django.forms import ModelForm
|
||||
import dataprep
|
||||
|
||||
import datetime
|
||||
|
||||
@@ -261,7 +263,7 @@ from rowers.interactiveplots import axlabels
|
||||
|
||||
formaxlabels = axlabels.copy()
|
||||
formaxlabels.pop('None')
|
||||
parchoices = list(sorted(axlabels.items(), key = lambda x:x[1]))
|
||||
parchoices = list(sorted(formaxlabels.items(), key = lambda x:x[1]))
|
||||
|
||||
|
||||
class ChartParamChoiceForm(forms.Form):
|
||||
@@ -275,9 +277,13 @@ class ChartParamChoiceForm(forms.Form):
|
||||
teamid = forms.IntegerField(widget=forms.HiddenInput())
|
||||
|
||||
formaxlabels.pop('time')
|
||||
metricchoices = list(sorted(axlabels.items(), key = lambda x:x[1]))
|
||||
metricchoices = list(sorted(formaxlabels.items(), key = lambda x:x[1]))
|
||||
|
||||
class FusionMetricChoiceForm(forms.Form):
|
||||
class FusionMetricChoiceForm(ModelForm):
|
||||
class Meta:
|
||||
model = Workout
|
||||
fields = []
|
||||
|
||||
posneg = (
|
||||
('pos','Workout 2 starts after Workout 1'),
|
||||
('neg','Workout 2 starts before Workout 1'),
|
||||
@@ -287,3 +293,17 @@ class FusionMetricChoiceForm(forms.Form):
|
||||
widget=forms.CheckboxSelectMultiple())
|
||||
posneg = forms.ChoiceField(choices=posneg,initial='pos')
|
||||
offset = forms.DurationField(label='Time Offset',initial=datetime.timedelta())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(FusionMetricChoiceForm, self).__init__(*args, **kwargs)
|
||||
# need to add code to remove "empty" fields
|
||||
|
||||
id = self.instance.id
|
||||
df = dataprep.getrowdata_db(id=id)
|
||||
|
||||
labeldict = {key:value for key,value in metricchoices}
|
||||
|
||||
for label in labeldict:
|
||||
if df[label].std() == 0:
|
||||
self.fields['columns'].choices.remove((label, labeldict[label]))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user