Merge branch 'release/v18.3.0'
This commit is contained in:
@@ -54,7 +54,7 @@ import arrow
|
||||
thetimezone = get_current_timezone()
|
||||
from rowingdata import (
|
||||
TCXParser, RowProParser, ErgDataParser,
|
||||
CoxMateParser, HeroParser,
|
||||
CoxMateParser, HeroParser, SmartRowParser,
|
||||
BoatCoachParser, RowPerfectParser, BoatCoachAdvancedParser,
|
||||
ETHParser,
|
||||
MysteryParser, BoatCoachOTWParser,QuiskeParser,
|
||||
@@ -1857,6 +1857,7 @@ parsers = {
|
||||
'eth': ETHParser,
|
||||
'nklinklogbook': NKLiNKLogbookParser,
|
||||
'hero': HeroParser,
|
||||
'smartrow': SmartRowParser,
|
||||
}
|
||||
|
||||
def get_startdate_time_zone(r,row,startdatetime=None):
|
||||
|
||||
@@ -814,7 +814,7 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
df.drop('duration',inplace=True,axis='columns')
|
||||
df.drop('trimp',inplace=True,axis='columns' )
|
||||
df.drop('distance',inplace=True, axis='columns')
|
||||
elif yaxis == 'distance':
|
||||
elif yaxis == 'distance': # pragma: no cover
|
||||
df.drop('duration',inplace=True,axis='columns')
|
||||
df.drop('trimp', inplace=True,axis='columns')
|
||||
df.drop('rscore',inplace=True,axis='columns')
|
||||
@@ -858,12 +858,12 @@ def interactive_activitychart2(workouts,startdate,enddate,stack='type',toolbar_l
|
||||
p.yaxis.axis_label = 'Duration (h)'
|
||||
elif yaxis == 'TRIMP':
|
||||
p.yaxis.axis_label = 'TRIMP'
|
||||
elif yaxis == 'distance':
|
||||
elif yaxis == 'distance': # pragma: no cover
|
||||
p.yaxis.axis_label = 'Distance (m)'
|
||||
else: # pragma: no cover
|
||||
p.yaxis.axis_label = 'rScore'
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -354,10 +354,10 @@ def get_polar_workouts(user):
|
||||
|
||||
def register_user(user, token):
|
||||
r = Rower.objects.get(user=user)
|
||||
if (r.polartoken == '') or (r.polartoken is None):
|
||||
if (r.polartoken == '') or (r.polartoken is None): # pragma: no cover
|
||||
s = "Token doesn't exist. Need to authorize"
|
||||
return custom_exception_handler(401,s)
|
||||
elif (timezone.now()>r.polartokenexpirydate):
|
||||
elif (timezone.now()>r.polartokenexpirydate): # pragma: no cover
|
||||
s = "Token expired. Needs to refresh"
|
||||
return custom_exception_handler(401,s)
|
||||
|
||||
@@ -390,7 +390,7 @@ def register_user(user, token):
|
||||
|
||||
#response = requests.post(url,params=params,headers=headers)
|
||||
|
||||
if response.status_code not in [200,201]:
|
||||
if response.status_code not in [200,201]: # pragma: no cover
|
||||
#dologging('polar.log',url)
|
||||
dologging('polar.log',headers)
|
||||
dologging('polar.log',payload)
|
||||
@@ -408,7 +408,7 @@ def register_user(user, token):
|
||||
|
||||
return polar_user_data
|
||||
|
||||
def get_polar_user_info(user,physical=False):
|
||||
def get_polar_user_info(user,physical=False): # pragma: no cover
|
||||
r = Rower.objects.get(user=user)
|
||||
if (r.polartoken == '') or (r.polartoken is None):
|
||||
s = "Token doesn't exist. Need to authorize"
|
||||
@@ -449,10 +449,10 @@ def get_polar_user_info(user,physical=False):
|
||||
def get_polar_workout(user,id,transactionid):
|
||||
|
||||
r = Rower.objects.get(user=user)
|
||||
if (r.polartoken == '') or (r.polartoken is None):
|
||||
if (r.polartoken == '') or (r.polartoken is None): # pragma: no cover
|
||||
s = "Token doesn't exist. Need to authorize"
|
||||
return custom_exception_handler(401,s)
|
||||
elif (timezone.now()>r.polartokenexpirydate):
|
||||
elif (timezone.now()>r.polartokenexpirydate): # pragma: no cover
|
||||
s = "Token expired. Needs to refresh"
|
||||
return custom_exception_handler(401,s)
|
||||
else:
|
||||
|
||||
@@ -46,7 +46,7 @@ from django.template.defaultfilters import stringfilter
|
||||
from six import string_types
|
||||
|
||||
@register.filter
|
||||
def workoutdate(id):
|
||||
def workoutdate(id): # pragma: no cover
|
||||
try:
|
||||
w = Workout.objects.get(id=id)
|
||||
return w.date
|
||||
@@ -92,7 +92,7 @@ landingpageicons = {
|
||||
def landingicon(landingpage):
|
||||
try:
|
||||
return landingpageicons[landingpage]
|
||||
except KeyError:
|
||||
except KeyError: # pragma: no cover
|
||||
return 'fas fa-search fa-fw'
|
||||
|
||||
@register.filter
|
||||
@@ -162,7 +162,7 @@ def weekbegin(nr):
|
||||
return False
|
||||
|
||||
@register.filter
|
||||
def discount(amount,rower):
|
||||
def discount(amount,rower): # pragma: no cover
|
||||
return credits.discount(amount,rower)
|
||||
|
||||
|
||||
@@ -387,8 +387,8 @@ def distanceprint(d):
|
||||
if d<10000:
|
||||
return "{d} m".format(d=d)
|
||||
|
||||
d2 = d/1000.
|
||||
return "%.2f km" % d2
|
||||
d2 = d/1000. # pragma: no cover
|
||||
return "%.2f km" % d2 # pragma: no cover
|
||||
|
||||
@register.filter
|
||||
def durationprint(d,dstring):
|
||||
@@ -499,7 +499,7 @@ def jsdict(dict,key): # pragma: no cover
|
||||
def icon(workouttype):
|
||||
try:
|
||||
s = workouttypes_icons.get(workouttype)
|
||||
except KeyError:
|
||||
except KeyError: # pragma: no cover
|
||||
s = "bike.svg"
|
||||
|
||||
iconstring = "{s}".format(s=s)
|
||||
|
||||
@@ -443,7 +443,7 @@ def rower_process_polarcallback(request):
|
||||
|
||||
if user_id:
|
||||
polar_user_data = polarstuff.register_user(request.user, access_token)
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
messages.error(request,'Polar Flow Authorization Failed')
|
||||
url = reverse('rower_exportsettings_view')
|
||||
return HttpResponseRedirect(url)
|
||||
@@ -451,10 +451,10 @@ def rower_process_polarcallback(request):
|
||||
|
||||
try:
|
||||
user_id2 = polar_user_data['polar-user-id']
|
||||
except KeyError:
|
||||
except KeyError: # pragma: no cover
|
||||
user_id2 = 0
|
||||
|
||||
if user_id2 != user_id:
|
||||
if user_id2 != user_id: # pragma: no cover
|
||||
messages.error(request,'Polar User ID error')
|
||||
|
||||
#expirydatetime = timezone.now()+datetime.timedelta(seconds=expires_in)
|
||||
@@ -469,7 +469,7 @@ def rower_process_polarcallback(request):
|
||||
if user_id2 == user_id:
|
||||
successmessage = "Tokens stored. Good to go. Please check your import/export settings"
|
||||
messages.info(request,successmessage)
|
||||
else:
|
||||
else: # pragma: no cover
|
||||
messages.error(request,"Please contact support@rowsandall.com for help.")
|
||||
url = reverse('rower_exportsettings_view')
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
@@ -2576,7 +2576,7 @@ def rower_view_instantplan(request,id='',userid=0):
|
||||
plan = InstantPlan.objects.get(uuid=id)
|
||||
try:
|
||||
discountedprice = credits.discounted(plan.price,r)
|
||||
except AttributeError:
|
||||
except AttributeError: # pragma: no cover
|
||||
discountedprice = plan.price
|
||||
|
||||
authorizationstring = 'Bearer '+settings.WORKOUTS_FIT_TOKEN
|
||||
@@ -2625,7 +2625,7 @@ def rower_view_instantplan(request,id='',userid=0):
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
# check if plan is free or credits are sufficient
|
||||
if plan.price > 0:
|
||||
if plan.price > 0: # pragma: no cover
|
||||
if plan.price > r.eurocredits:
|
||||
messages.error(request,'You did not have enough credit to purchase this plan')
|
||||
url = reverse('rower_view_instantplan',kwargs={
|
||||
@@ -2638,7 +2638,7 @@ def rower_view_instantplan(request,id='',userid=0):
|
||||
|
||||
|
||||
if form.is_valid():
|
||||
if plan.price > 0:
|
||||
if plan.price > 0: # pragma: no cover
|
||||
eurocredits = credits.withdraw(plan.price,r)
|
||||
|
||||
plansteps = response.json()
|
||||
|
||||
Reference in New Issue
Block a user