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