diff --git a/rowers/forms.py b/rowers/forms.py index 8599496b..ffef4328 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -746,7 +746,8 @@ class PlanSelectForm(forms.Form): self.fields['plan'].empty_label = None if paymentprocessor: self.fields['plan'].queryset = PaidPlan.objects.filter( - paymentprocessor=paymentprocessor + paymentprocessor=paymentprocessor, + active=True ).exclude( shortname="basic" ).order_by( @@ -758,7 +759,8 @@ class PlanSelectForm(forms.Form): except AttributeError: amount = 0 self.fields['plan'].queryset = PaidPlan.objects.filter( - paymentprocessor=rower.paymentprocessor + paymentprocessor=rower.paymentprocessor, + active=True ).exclude( price__lte=amount ).order_by( diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index d1b88a42..1c21937d 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -248,7 +248,7 @@ def interactive_activitychart(workouts,startdate,enddate,stack='type'): rowersinitials = {} seen = ['seen'] idseen = [] - + for w in workouts: aantal=1 initials = w.user.user.first_name[0:aantal]+w.user.user.last_name[0:aantal] @@ -673,6 +673,9 @@ def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower'): dates = [m.date for m in fitnessmetrics] mode = [m.workoutmode for m in fitnessmetrics] + if len(power4min) == 0: + return ['',''] + df = pd.DataFrame( {'power4min':power4min, 'power2k':power2k, @@ -808,7 +811,6 @@ def interactive_histoall(theworkouts): rowdata = dataprep.getsmallrowdata_db(['power'],ids=ids,doclean=True) - rowdata.dropna(axis=0,how='any',inplace=True) if rowdata.empty: @@ -1270,45 +1272,6 @@ def leaflet_chart2(lat,lon,name=""): return script,div - -def googlemap_chart(lat,lon,name=""): - if lat.empty or lon.empty: - return [0,"invalid coordinate data"] - # plot tools - TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,resize' - - map_options = GMapOptions(lat = lat.mean(),lng=lon.mean(), - map_type="roadmap",zoom=13) - - plot = GMapPlot( - x_range=DataRange1d(), y_range=DataRange1d(), - map_options=map_options, - api_key = "AIzaSyAgu1w9QSthaGPMLp8y9JedPoMc9sfEgJ8", - plot_width=400,plot_height=400, - toolbar_sticky=False, - - ) - - - source = ColumnDataSource( - data = dict( - lat=lat, - lon=lon, - ) - ) - - circle = Circle(x="lon",y="lat",size=5,fill_color="blue", - fill_alpha=0.2,line_color=None) - plot.add_glyph(source,circle) - plot.add_tools(PanTool(), WheelZoomTool(), - SaveTool(), ResizeTool(), ResetTool(), - TapTool(),CrosshairTool(), - ) - plot.title.text = name - plot.title.text_font="1.0em" - script, div = components(plot) - - return [script,div] def interactive_agegroupcpchart(age,normalized=False): durations = [1,4,30,60] diff --git a/rowers/models.py b/rowers/models.py index ab8f822f..29322052 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -568,6 +568,8 @@ class PaidPlan(models.Model): choices=paymenttypes, ) + active = models.BooleanField(default=True) + clubsize = models.IntegerField(default=0) def __unicode__(self): diff --git a/rowers/payments.py b/rowers/payments.py index 503d6f4b..1e4304fa 100644 --- a/rowers/payments.py +++ b/rowers/payments.py @@ -10,27 +10,30 @@ def planstopaypal(): plan.external_id = None plan.save() -def initiaterowerplans(): - rowers = Rower.objects.filter(paymenttype = 'recurring',paidplan = None) - for r in rowers: - r.paymentprocessor = 'paypal' - r.save() +#def initiaterowerplans(): +# rowers = Rower.objects.filter(paymenttype = 'recurring',paidplan = None) +# for r in rowers: +# r.paymentprocessor = 'paypal' +# r.save() -def setrowerplans(): - rowers = Rower.objects.all() +#def setrowerplans(): +# rowers = Rower.objects.all() - for r in rowers: - paidplans = PaidPlan.objects.filter( - shortname = r.rowerplan, - paymenttype = r.paymenttype, - clubsize = r.clubsize, - paymentprocessor=r.paymentprocessor) +# for r in rowers: +# paidplans = PaidPlan.objects.filter( +# shortname = r.rowerplan, +# paymenttype = r.paymenttype, +# clubsize = r.clubsize, +# paymentprocessor=r.paymentprocessor) - if paidplans: - r.paidplan = paidplans[0] - r.save() - else: - print 'Could not set plan for ',r +# if paidplans: +# r.paidplan = paidplans[0] +# r.save() +# else: +# try: +# print 'Could not set plan for ',r.user.username +# except: +# pass def is_existing_customer(rower): if rower.country is not None and rower.customer_id is not None and rower.country != '': diff --git a/rowers/templates/about_us.html b/rowers/templates/about_us.html index 1d64d9b4..c178aa32 100644 --- a/rowers/templates/about_us.html +++ b/rowers/templates/about_us.html @@ -93,7 +93,7 @@ and inspired by the RowPro Dan Burpee spreadsheet

We offer three plans. Click on the name of the plan to find out more: