emailprocessing stops in a controlled way
This commit is contained in:
@@ -847,52 +847,65 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
||||
def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
oarlength = 2.89
|
||||
inboard = 0.88
|
||||
hasrecognized = False
|
||||
# handle RowPro:
|
||||
if (fileformat == 'rp'):
|
||||
row = RowProParser(f2)
|
||||
hasrecognized = True
|
||||
# handle TCX
|
||||
if (fileformat == 'tcx'):
|
||||
row = TCXParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle Mystery
|
||||
if (fileformat == 'mystery'):
|
||||
row = MysteryParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle RowPerfect
|
||||
if (fileformat == 'rowperfect3'):
|
||||
row = RowPerfectParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle ErgData
|
||||
if (fileformat == 'ergdata'):
|
||||
row = ErgDataParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle CoxMate
|
||||
if (fileformat == 'coxmate'):
|
||||
row = CoxMateParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle Mike
|
||||
if (fileformat == 'bcmike'):
|
||||
row = BoatCoachAdvancedParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle BoatCoach
|
||||
if (fileformat == 'boatcoach'):
|
||||
row = BoatCoachParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle BoatCoach OTW
|
||||
if (fileformat == 'boatcoachotw'):
|
||||
row = BoatCoachOTWParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle painsled desktop
|
||||
if (fileformat == 'painsleddesktop'):
|
||||
row = painsledDesktopParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle speed coach GPS
|
||||
if (fileformat == 'speedcoach'):
|
||||
row = speedcoachParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle speed coach GPS 2
|
||||
if (fileformat == 'speedcoach2'):
|
||||
row = SpeedCoach2Parser(f2)
|
||||
hasrecognized = True
|
||||
try:
|
||||
oarlength, inboard = get_empower_rigging(f2)
|
||||
summary = row.allstats()
|
||||
@@ -902,10 +915,12 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
# handle ErgStick
|
||||
if (fileformat == 'ergstick'):
|
||||
row = ErgStickParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
# handle FIT
|
||||
if (fileformat == 'fit'):
|
||||
row = FITParser(f2)
|
||||
hasrecognized = True
|
||||
try:
|
||||
s = fitsummarydata(f2)
|
||||
s.setsummary()
|
||||
@@ -913,6 +928,13 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
except:
|
||||
pass
|
||||
|
||||
# Handle c2log
|
||||
if (fileformat == 'c2log' or fileformat == 'rowprolog'):
|
||||
return (0,0,0,0)
|
||||
|
||||
if not hasrecognized:
|
||||
return (0,0,0,0)
|
||||
|
||||
f_to_be_deleted = f2
|
||||
# should delete file
|
||||
f2 = f2[:-4] + 'o.csv'
|
||||
@@ -971,7 +993,7 @@ def new_workout_from_file(r, f2,
|
||||
# Some people try to upload Concept2 logbook summaries
|
||||
if fileformat == 'c2log':
|
||||
os.remove(f2)
|
||||
message = "This C2 logbook summary does not contain stroke data. Please download the Export Stroke Data file from the workout details on the C2 logbook."
|
||||
message = "This summary does not contain stroke data. Use the files containing stroke by stroke data."
|
||||
return (0, message, f2)
|
||||
|
||||
if fileformat == 'nostrokes':
|
||||
@@ -1021,14 +1043,16 @@ def new_workout_from_file(r, f2,
|
||||
return (0, message, '')
|
||||
|
||||
dosummary = (fileformat != 'fit')
|
||||
id, message = save_workout_database(f2, r,
|
||||
workouttype=workouttype,
|
||||
makeprivate=makeprivate,
|
||||
dosummary=dosummary,
|
||||
workoutsource=fileformat,
|
||||
summary=summary,
|
||||
inboard=inboard, oarlength=oarlength,
|
||||
title=title)
|
||||
id, message = save_workout_database(
|
||||
f2, r,
|
||||
workouttype=workouttype,
|
||||
makeprivate=makeprivate,
|
||||
dosummary=dosummary,
|
||||
workoutsource=fileformat,
|
||||
summary=summary,
|
||||
inboard=inboard, oarlength=oarlength,
|
||||
title=title
|
||||
)
|
||||
|
||||
return (id, message, f2)
|
||||
|
||||
|
||||
@@ -115,6 +115,8 @@ def make_new_workout_from_email(rower, datafile, name, cntr=0):
|
||||
if fileformat != 'csv':
|
||||
filename_mediadir, summary, oarlength, inboard = dataprep.handle_nonpainsled(
|
||||
'media/' + datafilename, fileformat, summary)
|
||||
if not filename_mediadir:
|
||||
return 0
|
||||
else:
|
||||
filename_mediadir = 'media/' + datafilename
|
||||
inboard = 0.88
|
||||
|
||||
Reference in New Issue
Block a user