Private
Public Access
1
0

Merge branch 'release/v20.1.27'

This commit is contained in:
2023-09-06 21:10:15 +02:00
4 changed files with 25 additions and 41 deletions
+22 -32
View File
@@ -939,6 +939,8 @@ def handle_check_race_course(self,
logfile = 'courselog_{workoutid}_{courseid}.log'.format(
workoutid=workoutid, courseid=courseid)
logfile2 = 'courses.log'
dologging(logfile2,logfile)
if 'debug' in kwargs: # pragma: no cover
debug = kwargs['debug']
@@ -981,6 +983,8 @@ def handle_check_race_course(self,
try:
row = rdata(csvfile=f1 + '.gz')
except IOError: # pragma: no cover
dologging(logfile,"Did not find file "+f1)
dologging(logfile2,"Did not find file "+f1)
return 0
row.extend_data()
@@ -994,6 +998,8 @@ def handle_check_race_course(self,
try:
_ = rowdata[' latitude']
except KeyError: # pragma: no cover
dologging(logfile,"No GPS Data")
dologging(logfile2,"No GPS Data")
return 0
rowdata.rename(columns={
@@ -1012,7 +1018,7 @@ def handle_check_race_course(self,
lambda x: safetimedelta(x)
).values
rowdata = rowdata.select_dtypes(['number'])
rowdata = rowdata.resample('100ms', on='dt').mean()
rowdata = rowdata.interpolate()
@@ -1036,18 +1042,12 @@ def handle_check_race_course(self,
except AttributeError: # pragma: no cover
entrytimes, entrydistances = time_in_path(rowdata, paths[0], maxmin='max', getall=True,
name='Start', logfile=logfile)
with open(logfile, 'ab') as f:
t = time.localtime()
timestamp = bytes('{t}'.format(
t=time.strftime('%b-%d-%Y_%H%M', t)), 'utf-8')
f.write(b'\n')
f.write(bytes('Course id {n}, Record id {m}'.format(
n=courseid, m=recordid), 'utf-8'))
f.write(b'\n')
f.write(timestamp)
f.write(b' ')
f.write(bytes('Found {n} entrytimes'.format(
n=len(entrytimes)), 'utf-8'))
logmessage = 'Course id {n}, Record id {m}'.format(n=courseid, m=recordid)
dologging(logfile,logmessage)
dologging(logfile2,logmessage)
logmessage = 'Found {n} entrytimes'.format(n=len(entrytimes))
dologging(logfile,logmessage)
dologging(logfile2,logmessage)
except InvalidTrajectoryError: # pragma: no cover
entrytimes = []
@@ -1062,14 +1062,9 @@ def handle_check_race_course(self,
endseconds = []
for startt in entrytimes:
with open(logfile, 'ab') as f:
t = time.localtime()
timestamp = bytes('{t}'.format(
t=time.strftime('%b-%d-%Y_%H%M', t)), 'utf-8')
f.write(b'\n')
f.write(timestamp)
f.write(b' ')
f.write(bytes('Path starting at {t}'.format(t=startt), 'utf-8'))
logmessage = 'Path starting at {t}'.format(t=startt)
dologging(logfile, logmessage)
dologging(logfile2, logmessage)
rowdata2 = rowdata[rowdata['time'] > (startt-10.)]
(
@@ -1102,7 +1097,6 @@ def handle_check_race_course(self,
'endsecond': endseconds,
})
#records = records[records['coursecompleted'] is True]
records = records.loc[records['coursecompleted'], : ]
if len(records):
@@ -1200,19 +1194,15 @@ def handle_check_race_course(self,
# add times for all gates to log file
with open(logfile, 'ab') as f:
t = time.localtime()
f.write(b'\n')
f.write(b' ')
f.write(b'--- LOG of all gate times---')
dologging(logfile,'--- LOG of all gate times---')
dologging(logfile2,'--- LOG of all gate times---')
for path, polygon in zip(paths, polygons):
(secs, meters, completed) = coursetime_paths(rowdata,
[path], polygons=[polygon], logfile=logfile)
with open(logfile, 'ab') as f:
line = " time: {t} seconds, distance: {m} meters".format(
t=secs, m=meters)
f.write(bytes(line, 'utf-8'))
logmessage = " time: {t} seconds, distance: {m} meters".format(t=secs, m=meters)
dologging(logfile,logmessage)
dologging(logfile2,logmessage)
# send email
handle_sendemail_coursefail(
@@ -2645,7 +2635,7 @@ def handle_makeplot(f1, f2, t, hrdata, plotnr, imagename,
if (plotnr in [1, 2, 4, 5, 8, 11, 9, 12]) and (nr_rows > 1200): # pragma: no cover
bin = int(nr_rows / 1200.)
try:
df = row.df.select_types(['number'])
df = row.df.select_dtypes(['number'])
df = df.groupby(lambda x: x / bin).mean()
row.df = df
except:
Binary file not shown.
+1 -1
View File
@@ -1170,7 +1170,7 @@ def rdata(csvfile=None, rower=rrower()):
res = 0
except (IOError, IndexError, EOFError, FileNotFoundError): # pragma: no cover
try:
res = rrdata(csvfile=file+'.gz', rower=rower)
res = rrdata(csvfile=csvfile+'.gz', rower=rower)
except (IOError, IndexError, EOFError, FileNotFoundError):
res = 0
+2 -8
View File
@@ -3825,12 +3825,6 @@ def workout_stats_view(request, id=0, message="", successmessage=""):
if datadf.empty:
return HttpResponse("CSV data file not found")
# datadf['deltat'] = datadf['time'].diff()
# workoutstateswork = [1, 4, 5, 8, 9, 6, 7]
# workoutstatesrest = [3]
# workoutstatetransition = [0, 2, 10, 11, 12, 13]
# Create stats
stats = {}
@@ -3943,13 +3937,13 @@ def workout_stats_view(request, id=0, message="", successmessage=""):
otherstats['trimp'] = {
'verbose_name': 'TRIMP',
'value': trimp,
'value': int(trimp),
'unit': ''
}
otherstats['hrScore'] = {
'verbose_name': 'rScore (HR)',
'value': hrtss,
'value': int(hrtss),
'unit': ''
}