fixing empower bug & NK SC summary
This commit is contained in:
@@ -1096,11 +1096,12 @@ def parsenonpainsled(fileformat,f2,summary):
|
||||
if (fileformat == 'rp'):
|
||||
row = RowProParser(f2)
|
||||
hasrecognized = True
|
||||
# handle TCX
|
||||
|
||||
# handle TCX
|
||||
if (fileformat == 'tcx'):
|
||||
row = TCXParser(f2)
|
||||
hasrecognized = True
|
||||
|
||||
|
||||
# handle Mystery
|
||||
if (fileformat == 'mystery'):
|
||||
row = MysteryParser(f2)
|
||||
@@ -1197,10 +1198,10 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
|
||||
# Handle c2log
|
||||
if (fileformat == 'c2log' or fileformat == 'rowprolog'):
|
||||
return (0,0,0,0)
|
||||
return (0,0,0,0,0)
|
||||
|
||||
if not hasrecognized:
|
||||
return (0,0,0,0)
|
||||
return (0,0,0,0,0)
|
||||
|
||||
f_to_be_deleted = f2
|
||||
# should delete file
|
||||
@@ -1209,7 +1210,7 @@ def handle_nonpainsled(f2, fileformat, summary=''):
|
||||
row2 = rrdata(df = row.df)
|
||||
row2.write_csv(f2, gzip=True)
|
||||
except:
|
||||
return (0,0,0,0)
|
||||
return (0,0,0,0,0)
|
||||
|
||||
# os.remove(f2)
|
||||
try:
|
||||
@@ -1311,9 +1312,10 @@ def new_workout_from_file(r, f2,
|
||||
if not f2:
|
||||
message = 'Something went wrong'
|
||||
return (0, message, '')
|
||||
except:
|
||||
except Exception as e:
|
||||
errorstring = str(sys.exc_info()[0])
|
||||
message = 'Something went wrong: ' + errorstring
|
||||
print e.message
|
||||
message = 'Something went wrong: ' + e.message
|
||||
return (0, message, '')
|
||||
|
||||
dosummary = (fileformat != 'fit' and 'speedcoach2' not in fileformat)
|
||||
|
||||
@@ -121,7 +121,7 @@ def make_new_workout_from_email(rower, datafile, name, cntr=0,testing=False):
|
||||
|
||||
# handle non-Painsled
|
||||
if fileformat != 'csv':
|
||||
filename_mediadir, summary, oarlength, inboard = dataprep.handle_nonpainsled(
|
||||
filename_mediadir, summary, oarlength, inboard,fileformat = dataprep.handle_nonpainsled(
|
||||
'media/' + datafilename, fileformat, summary)
|
||||
if not filename_mediadir:
|
||||
return 0
|
||||
@@ -148,7 +148,7 @@ def make_new_workout_from_email(rower, datafile, name, cntr=0,testing=False):
|
||||
pass
|
||||
|
||||
row.write_csv(datafilename, gzip=True)
|
||||
dosummary = (fileformat != 'fit')
|
||||
dosummary = (fileformat != 'fit' and 'speedcoach2' not in fileformat)
|
||||
|
||||
if name == '':
|
||||
name = 'Workout from Background Queue'
|
||||
|
||||
@@ -846,7 +846,7 @@ class ViewTest(TestCase):
|
||||
f_to_be_deleted = w.csvfilename
|
||||
os.remove(f_to_be_deleted+'.gz')
|
||||
|
||||
def test_upload_view_TCX_SpeedCoach2(self):
|
||||
def test_upload_view_TCX_SpeedCoach2a(self):
|
||||
self.c.login(username='john',password='koeinsloot')
|
||||
|
||||
filename = 'rowers/testdata/Speedcoach2example.csv'
|
||||
@@ -876,7 +876,7 @@ class ViewTest(TestCase):
|
||||
f_to_be_deleted = w.csvfilename
|
||||
os.remove(f_to_be_deleted+'.gz')
|
||||
|
||||
def test_upload_view_TCX_SpeedCoach2(self):
|
||||
def test_upload_view_TCX_SpeedCoach2b(self):
|
||||
self.c.login(username='john',password='koeinsloot')
|
||||
|
||||
filename = 'rowers/testdata/Speedcoach2example.csv'
|
||||
@@ -908,7 +908,7 @@ class ViewTest(TestCase):
|
||||
|
||||
|
||||
|
||||
def test_upload_view_TCX_SpeedCoach2(self):
|
||||
def test_upload_view_TCX_SpeedCoach2c(self):
|
||||
self.c.login(username='john',password='koeinsloot')
|
||||
|
||||
filename = 'rowers/testdata/speedcoach3test3.csv'
|
||||
|
||||
Reference in New Issue
Block a user