diff --git a/rowers/models.py b/rowers/models.py index d63af15c..c89fcb9d 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -697,6 +697,14 @@ class Rower(models.Model): ('Workout','Workout'), ('Yoga','Yoga'), ) + + gridtypes = ( + ('none',None), + ('both','both'), + ('x','x'), + ('y','y'), + ) + user = models.OneToOneField(User,on_delete=models.CASCADE) #billing details @@ -880,6 +888,10 @@ class Rower(models.Model): showfavoritechartnotes = models.BooleanField(default=True, verbose_name='Show Notes for Favorite Charts') + # Static chart settings + staticgrids = models.CharField(default=None,choices=gridtypes,null=True,max_length=50, + verbose_name='Chart Grid') + def __str__(self): return self.user.first_name+' '+self.user.last_name @@ -3438,7 +3450,15 @@ class AccountRowerForm(ModelForm): if 'coach' not in self.instance.rowerplan: self.fields.pop('offercoaching') +# Form to set static chart settings +class StaticChartRowerForm(ModelForm): + class Meta: + model = Rower + fields = ['staticgrids'] + def __init__(self, *args, **kwargs): + super(StaticChartRowerForm, self).__init__(*args, **kwargs) + self.fields['staticgrids'].required = False class UserForm(ModelForm): diff --git a/rowers/tasks.py b/rowers/tasks.py index bf502f43..7f3ff101 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -1902,34 +1902,34 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename, row.df = df nr_rows = len(row.df) if (plotnr == 1): - fig1 = row.get_timeplot_erg(t) + fig1 = row.get_timeplot_erg(t,**kwargs) elif (plotnr == 2): - fig1 = row.get_metersplot_erg(t) + fig1 = row.get_metersplot_erg(t,**kwargs) elif (plotnr == 3): t += ' - Heart Rate Distribution' - fig1 = row.get_piechart(t) + fig1 = row.get_piechart(t,**kwargs) elif (plotnr == 4): if haspower: - fig1 = row.get_timeplot_otwempower(t) + fig1 = row.get_timeplot_otwempower(t,**kwargs) else: - fig1 = row.get_timeplot_otw(t) + fig1 = row.get_timeplot_otw(t,**kwargs) elif (plotnr == 5): if haspower: - fig1 = row.get_metersplot_otwempower(t) + fig1 = row.get_metersplot_otwempower(t,**kwargs) else: - fig1 = row.get_metersplot_otw(t) + fig1 = row.get_metersplot_otw(t,**kwargs) elif (plotnr == 6): t += ' - Heart Rate Distribution' - fig1 = row.get_piechart(t) + fig1 = row.get_piechart(t,**kwargs) elif (plotnr == 7) or (plotnr == 10): - fig1 = row.get_metersplot_erg2(t) + fig1 = row.get_metersplot_erg2(t,**kwargs) elif (plotnr == 8) or (plotnr == 11): - fig1 = row.get_timeplot_erg2(t) + fig1 = row.get_timeplot_erg2(t,**kwargs) elif (plotnr == 9) or (plotnr == 12): - fig1 = row.get_time_otwpower(t) + fig1 = row.get_time_otwpower(t,**kwargs) elif (plotnr == 13) or (plotnr == 16): t += ' - Power Distribution' - fig1 = row.get_power_piechart(t) + fig1 = row.get_power_piechart(t,**kwargs) if fig1 is None: return 0 diff --git a/rowers/templates/favoritecharts.html b/rowers/templates/favoritecharts.html index 63fc02e5..bdb933ee 100644 --- a/rowers/templates/favoritecharts.html +++ b/rowers/templates/favoritecharts.html @@ -1,8 +1,21 @@ {% extends "newbase.html" %} -{% block title %}Change Favorite Charts{% endblock %} +{% block title %}Change Charts Settings {% endblock %} {% block main %} +
+
+ + +