diff --git a/rowers/idoklad.py b/rowers/idoklad.py index 2119a662..684f8d18 100644 --- a/rowers/idoklad.py +++ b/rowers/idoklad.py @@ -87,6 +87,8 @@ def get_contacts(rower): res = requests.get(url, headers=headers) dologging('idoklad.log','Searching Contact Status code '+str(res.status_code)+'\n') + #dologging('idoklad.log','Searching Contact Status code '+str(res.text)+'\n') + dologging('idoklad.log','Searching Contact Status code '+str(res.reason)+'\n') if res.status_code != 200: # pragma: no cover return None @@ -146,7 +148,7 @@ def create_contact(rower): res = requests.post(contacts_url, json=data, headers=headers) if res.status_code not in [200, 201]: - dologging('idoklad.log','Contact Created - reason '+str(res.reason)+'\n') + dologging('idoklad.log','Contact Not Created - reason '+str(res.reason)+'\n') _ = myqueue( queuehigh, handle_send_email_noinvoice, rower.user.email, diff --git a/rowers/models.py b/rowers/models.py index dbaa5d34..9da7d653 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -1258,6 +1258,7 @@ class Rower(models.Model): imports_are_private = models.BooleanField(default=False, verbose_name='Make imports private by default') show_commutes = models.BooleanField(default=False, verbose_name='Show commutes in workout list') + small_commutes = models.BooleanField(default=False, verbose_name='Show commutes on a single line in workout list') # Friends/Team friends = models.ManyToManyField("self", blank=True) @@ -5182,6 +5183,7 @@ class AccountRowerForm(ModelForm): 'defaultlandingpage2', 'defaultlandingpage3', 'show_commutes', + 'small_commutes', 'offercoaching', 'autojoin', 'emailalternatives'] widgets = { diff --git a/rowers/tasks.py b/rowers/tasks.py index 8468fab2..ca5c7518 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -1804,7 +1804,7 @@ def sigdig(value, digits=3): def handle_send_email_noinvoice( useremail, userfirstname, userlastname, reason, **kwargs): - subject = "Reason" + subject = "Idoklad: No invoice created" from_email = 'Rowsandall ' d = { @@ -1813,7 +1813,7 @@ def handle_send_email_noinvoice( 'reason': reason, } - _ = send_template_email(from_email, support@rowsandall.com, subject, + _ = send_template_email(from_email, "support@rowsandall.com", subject, 'paymentconfirmationemail_noinvoice.html', d, **kwargs) diff --git a/rowers/templates/list_workouts.html b/rowers/templates/list_workouts.html index cd31fc05..e1e06146 100644 --- a/rowers/templates/list_workouts.html +++ b/rowers/templates/list_workouts.html @@ -34,6 +34,11 @@ {% endif %} +{% if nr_commutes %} +

+ Show {{ nr_commutes }} commutes +

+{% endif %}
  • @@ -104,7 +109,7 @@ {% endif %} {% for workout in workouts %} - {% if not workout.is_commute %} + {% if not workout.is_commute or not user.rower.small_commutes %}
  • {% if request.GET.selectworkouts %} @@ -202,7 +207,7 @@
  • - {% elif user.rower.show_commutes %} + {% elif show_commutes and user.rower.small_commutes %}
  • diff --git a/rowers/tests/testdata/testdata.tcx.gz b/rowers/tests/testdata/testdata.tcx.gz index b81e6990..866e4895 100644 Binary files a/rowers/tests/testdata/testdata.tcx.gz and b/rowers/tests/testdata/testdata.tcx.gz differ diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py index 7399e16b..31864c0d 100644 --- a/rowers/views/workoutviews.py +++ b/rowers/views/workoutviews.py @@ -2145,6 +2145,10 @@ def workouts_view(request, message='', successmessage='', request.session['referer'] = absolute(request)['PATH'] r = getrequestrower(request, rowerid=rowerid, userid=userid) + show_commutes = request.GET.get('show_commutes', False) + if show_commutes == 'true': + show_commutes = True + # check if access is allowed startdate = datetime.datetime.combine(startdate, datetime.time()) @@ -2264,9 +2268,13 @@ def workouts_view(request, message='', successmessage='', g_enddate = timezone.now() g_startdate = (timezone.now()-timedelta(days=15)) - if not r.show_commutes: + nr_commutes = 0 + show_commutes = show_commutes or r.show_commutes + if not show_commutes: + nr_commutes = workouts.filter(is_commute=True).count() workouts = workouts.exclude(is_commute=True) + workoutsnohr = workouts.exclude(averagehr__isnull=False) for w in workoutsnohr: # pragma: no cover _ = dataprep.workout_trimp(w) @@ -2358,6 +2366,8 @@ def workouts_view(request, message='', successmessage='', 'totalmeters': totalmeters, 'totalminutes': totalminutes, 'totalhours': totalhours, + 'nr_commutes': nr_commutes, + 'show_commutes': show_commutes, })