Private
Public Access
1
0

coverage changes

This commit is contained in:
Sander Roosendaal
2021-09-15 10:10:48 +02:00
parent 86cef108fe
commit 8205fd3c3f
12 changed files with 26 additions and 19 deletions

View File

@@ -631,8 +631,15 @@ def createc2workoutdata(w):
spmav = int(row.df[' Cadence (stokes/min)'][mask].mean().astype(int)) spmav = int(row.df[' Cadence (stokes/min)'][mask].mean().astype(int))
hrav = int(row.df[' HRCur (bpm)'][mask].mean().astype(int)) hrav = int(row.df[' HRCur (bpm)'][mask].mean().astype(int))
except AttributeError: # pragma: no cover except AttributeError: # pragma: no cover
spmav = int(row.df[' Cadence (stokes/min)'][mask].mean()) try:
hrav = int(row.df[' HRCur (bpm)'][mask].mean()) spmav = int(row.df[' Cadence (stokes/min)'][mask].mean())
hrav = int(row.df[' HRCur (bpm)'][mask].mean())
except ValuError:
smpav = 0
try:
hrav = int(row.df[' HRCur (bpm)'][mask].mean())
except ValuError:
hrav = 0
intervaldict = { intervaldict = {
'type': 'distance', 'type': 'distance',
'time': int(10*itime[i]), 'time': int(10*itime[i]),

View File

@@ -2544,7 +2544,7 @@ def getsmallrowdata_db(columns, ids=[], doclean=True,workstrokesonly=True,comput
try: try:
df = pd.concat(data,axis=0) df = pd.concat(data,axis=0)
except ValueError: except ValueError: # pragma: no cover
return pd.DataFrame() return pd.DataFrame()
# df = dd.concat(data,axis=0) # df = dd.concat(data,axis=0)

View File

@@ -2153,7 +2153,7 @@ def interactive_histoall(theworkouts,histoparam,includereststrokes,
# throw out nans # throw out nans
histopwr = histopwr[~np.isinf(histopwr)] histopwr = histopwr[~np.isinf(histopwr)]
if histoparam == 'catch': if histoparam == 'catch': # pragma: no cover
histopwr = histopwr[histopwr < yaxminima[histoparam]] histopwr = histopwr[histopwr < yaxminima[histoparam]]
histopwr = histopwr[histopwr > yaxmaxima[histoparam]] histopwr = histopwr[histopwr > yaxmaxima[histoparam]]
else: else:
@@ -6871,7 +6871,7 @@ def interactive_zoneschart(rower,data,startdate,enddate,trainingzones='hr',date_
df.sort_values('date_sorting',inplace=True) df.sort_values('date_sorting',inplace=True)
df.drop('date_sorting',inplace=True,axis='columns') df.drop('date_sorting',inplace=True,axis='columns')
df['totaltime'] = 0 df['totaltime'] = 0
if df.empty: if df.empty: # pragma: no cover
return '','No Data Found' return '','No Data Found'
if yaxis == 'percentage': if yaxis == 'percentage':

View File

@@ -309,7 +309,7 @@ class Command(BaseCommand):
# Strava # Strava
rowers = Rower.objects.filter(strava_auto_import=True) rowers = Rower.objects.filter(strava_auto_import=True)
for r in rowers: for r in rowers:
if user_is_not_basic(r.user): if user_is_not_basic(r.user): # pragma: no cover
stravastuff.get_strava_workouts(r) stravastuff.get_strava_workouts(r)
self.stdout.write(self.style.SUCCESS( self.stdout.write(self.style.SUCCESS(

View File

@@ -3235,7 +3235,7 @@ class Workout(models.Model):
raise forms.ValidationError("Free Coach User cannot have any workouts") raise forms.ValidationError("Free Coach User cannot have any workouts")
if self.timezone == 'tzutc()': if self.timezone == 'tzutc()':
self.timezone = 'UTC' self.timezone = 'UTC' # pragma: no cover
super(Workout, self).save(*args, **kwargs) super(Workout, self).save(*args, **kwargs)

View File

@@ -380,7 +380,7 @@ def get_todays_micro(plan,thedate=timezone.now()):
if thismicro: if thismicro:
thismicro = thismicro[0] thismicro = thismicro[0]
else: else: # pragma: no cover
mms = TrainingMicroCycle.objects.all() mms = TrainingMicroCycle.objects.all()
return None return None

View File

@@ -159,7 +159,7 @@ def createsporttracksworkoutdata(w):
t = row.df.loc[:,'TimeStamp (sec)'].values-row.df.loc[:,'TimeStamp (sec)'].iloc[0] t = row.df.loc[:,'TimeStamp (sec)'].values-row.df.loc[:,'TimeStamp (sec)'].iloc[0]
try: try:
t[0] = t[1] t[0] = t[1]
except IndexError: except IndexError: # pragma: no cover
return 0 return 0
d = row.df.loc[:,'cum_dist'].values d = row.df.loc[:,'cum_dist'].values

View File

@@ -335,11 +335,11 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
failed = True failed = True
except stravalib.exc.ObjectNotFound: # pragma: no cover except stravalib.exc.ObjectNotFound: # pragma: no cover
failed = True failed = True
except IndexError: except IndexError: # pragma: no cover
failed = True failed = True
except ActivityUploadFailed: # pragma: no cover except ActivityUploadFailed: # pragma: no cover
failed = True failed = True
except FileNotFoundError: except FileNotFoundError: # pragma: no cover
failed = True failed = True
if not failed: if not failed:
@@ -3399,7 +3399,7 @@ def fetch_strava_workout(stravatoken,oauth_data,stravaid,csvfilename,userid,debu
try: try:
workoutsummary = requests.get(url,headers=headers).json() workoutsummary = requests.get(url,headers=headers).json()
except: except: # pragma: no cover
return 0 return 0

Binary file not shown.

View File

@@ -865,7 +865,7 @@ def workout_rp3import_view(request,userid=0):
try: try:
rp3ids = workouts_list['id'].values rp3ids = workouts_list['id'].values
except KeyError: except KeyError: # pragma: no cover
rp3ids = [] rp3ids = []
knownrp3ids = uniqify([ knownrp3ids = uniqify([
@@ -879,7 +879,7 @@ def workout_rp3import_view(request,userid=0):
for key,data in workouts_list.iterrows(): for key,data in workouts_list.iterrows():
try: try:
i = data['id'] i = data['id']
except KeyError: except KeyError: # pragma: no cover
i = 0 i = 0
if i in knownrp3ids: # pragma: no cover if i in knownrp3ids: # pragma: no cover
nnn = '' nnn = ''
@@ -888,7 +888,7 @@ def workout_rp3import_view(request,userid=0):
try: try:
s = data['executed_at'] s = data['executed_at']
except KeyError: except KeyError: # pragma: no cover
s = '' s = ''
keys = ['id','starttime','new'] keys = ['id','starttime','new']
@@ -1003,7 +1003,7 @@ def workout_stravaimport_view(request,message="",userid=0):
workouts.append(res2) workouts.append(res2)
if request.method == "POST": if request.method == "POST":
try: try: # pragma: no cover
tdict = dict(request.POST.lists()) tdict = dict(request.POST.lists())
ids = tdict['workoutid'] ids = tdict['workoutid']
stravaids = [int(id) for id in ids] stravaids = [int(id) for id in ids]

View File

@@ -842,7 +842,7 @@ def plannedsession_multicreate_view(request,
if request.method == "POST": if request.method == "POST":
ps_formset = PlannedSessionFormSet(queryset = qset, ps_formset = PlannedSessionFormSet(queryset = qset,
data = request.POST) data = request.POST)
if ps_formset.is_valid(): if ps_formset.is_valid(): # pragma: no cover
instances = ps_formset.save(commit=False) instances = ps_formset.save(commit=False)
for ps in instances: for ps in instances:
ps.save() ps.save()

View File

@@ -3504,7 +3504,7 @@ def workout_stats_view(request,id=0,message="",successmessage=""):
if not np.isnan(hrdrift): if not np.isnan(hrdrift):
try: try:
hrdrift = int(100*hrdrift)/100. hrdrift = int(100*hrdrift)/100.
except: except: # pragma: no cover
hrdrift = 0 hrdrift = 0
otherstats['hrdrift'] = { otherstats['hrdrift'] = {
'verbose_name': 'Heart Rate Drift', 'verbose_name': 'Heart Rate Drift',
@@ -6177,7 +6177,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
timeprev = int(df['time'].values[0]) timeprev = int(df['time'].values[0])
timenext = int(df['time'].values[result[0]]) timenext = int(df['time'].values[result[0]])
s = '{delta}sec'.format(delta=timenext-timeprev) s = '{delta}sec'.format(delta=timenext-timeprev)
except IndexError: except IndexError: # pragma: no cover
s = '0sec' s = '0sec'