checking in changes
This commit is contained in:
@@ -2680,7 +2680,10 @@ def interactive_windchart(id=0,promember=0):
|
||||
if rowdata == 0:
|
||||
return 0
|
||||
|
||||
dist = rowdata.df.loc[:,'cum_dist']
|
||||
try:
|
||||
dist = rowdata.df.loc[:,'cum_dist']
|
||||
except KeyError:
|
||||
return ['','No Data Found']
|
||||
|
||||
try:
|
||||
vwind = rowdata.df.loc[:,'vwind']
|
||||
@@ -2770,7 +2773,10 @@ def interactive_streamchart(id=0,promember=0):
|
||||
if rowdata == 0:
|
||||
return "","No Valid Data Available"
|
||||
|
||||
dist = rowdata.df.loc[:,'cum_dist']
|
||||
try:
|
||||
dist = rowdata.df.loc[:,'cum_dist']
|
||||
except KeyError:
|
||||
return ['','No Data found']
|
||||
|
||||
try:
|
||||
vstream = rowdata.df.loc[:,'vstream']
|
||||
|
||||
@@ -249,8 +249,11 @@ def workout_csvemail_view(request,id=0):
|
||||
rowdate = rowdata.rowdatetime
|
||||
starttimeunix = arrow.get(rowdate).timestamp
|
||||
df = rowdata.df
|
||||
df[' ElapsedTime (sec)'] = df['TimeStamp (sec)']
|
||||
df['TimeStamp (sec)'] = df['TimeStamp (sec)'] + starttimeunix
|
||||
try:
|
||||
df[' ElapsedTime (sec)'] = df['TimeStamp (sec)']
|
||||
df['TimeStamp (sec)'] = df['TimeStamp (sec)'] + starttimeunix
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
response = HttpResponse(df.to_csv())
|
||||
response['Content-Disposition'] = 'attachment; filename="%s"' % filename
|
||||
|
||||
@@ -1224,8 +1224,6 @@ def plannedsessions_manage_view(request,userid=0,
|
||||
if request.is_ajax():
|
||||
is_ajax = True
|
||||
|
||||
|
||||
|
||||
r = getrequestrower(request,userid=userid)
|
||||
|
||||
startdate,enddate = get_dates_timeperiod(request)
|
||||
|
||||
@@ -347,6 +347,9 @@ def get_user_by_userid(*args,**kwargs):
|
||||
except KeyError:
|
||||
id = request.user.id
|
||||
|
||||
if id is not None and int(id) == 0:
|
||||
id = request.user.id
|
||||
|
||||
u = get_object_or_404(User,pk=id)
|
||||
return u
|
||||
|
||||
@@ -370,6 +373,9 @@ def getrequestrower(request,rowerid=0,userid=0,notpermanent=False):
|
||||
userid = int(userid)
|
||||
rowerid = int(rowerid)
|
||||
|
||||
if userid == 0:
|
||||
userid = request.user.id
|
||||
|
||||
if notpermanent == False:
|
||||
if rowerid == 0 and 'rowerid' in request.session:
|
||||
rowerid = request.session['rowerid']
|
||||
@@ -977,10 +983,10 @@ def rowhascoordinates(row):
|
||||
def rdata(file,rower=rrower()):
|
||||
try:
|
||||
res = rrdata(csvfile=file,rower=rower)
|
||||
except (IOError, IndexError, EOFError):
|
||||
except (IOError, IndexError, EOFError,FileNotFoundError):
|
||||
try:
|
||||
res = rrdata(csvfile=file+'.gz',rower=rower)
|
||||
except (IOError, IndexError, EOFError):
|
||||
except (IOError, IndexError, EOFError,FileNotFoundError):
|
||||
res = 0
|
||||
|
||||
return res
|
||||
|
||||
@@ -2944,8 +2944,10 @@ def workout_data_view(request, id=0):
|
||||
|
||||
datadf,row = dataprep.getrowdata_db(id=encoder.decode_hex(id))
|
||||
|
||||
|
||||
datadf.sort_values(['ftime'],inplace=True)
|
||||
try:
|
||||
datadf.sort_values(['ftime'],inplace=True)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
columns = datadf.columns.values
|
||||
|
||||
@@ -2970,11 +2972,13 @@ def workout_data_view(request, id=0):
|
||||
tcols = ['ftime','cumdist','fpace','spm','hr','power']
|
||||
|
||||
datadf = datadf[cols]
|
||||
datadf.loc[:,'hr'] = datadf['hr'].astype('int')
|
||||
datadf.loc[:,'power'] = datadf['power'].astype('int')
|
||||
datadf.loc[:,'distance'] = datadf['distance'].astype('int')
|
||||
datadf.loc[:,'spm'] = 10*datadf['spm'].astype('int')/10.
|
||||
|
||||
try:
|
||||
datadf.loc[:,'hr'] = datadf['hr'].astype('int')
|
||||
datadf.loc[:,'power'] = datadf['power'].astype('int')
|
||||
datadf.loc[:,'distance'] = datadf['distance'].astype('int')
|
||||
datadf.loc[:,'spm'] = 10*datadf['spm'].astype('int')/10.
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
if request.method == 'POST':
|
||||
form = DataFrameColumnsForm(request.POST)
|
||||
@@ -2987,9 +2991,12 @@ def workout_data_view(request, id=0):
|
||||
try:
|
||||
datadf = datadf[tcols]
|
||||
except KeyError:
|
||||
tcols = list(set(datadf.columns(tolist)+tcols))
|
||||
datadf = datadf[tcols]
|
||||
datadf = datadf.fillna(value=0)
|
||||
# tcols = list(set(datadf.columns(tolist)+tcols))
|
||||
try:
|
||||
datadf = datadf[tcols]
|
||||
datadf = datadf.fillna(value=0)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
for col in cols:
|
||||
try:
|
||||
@@ -4068,7 +4075,9 @@ def workout_edit_view(request,id=0,message="",successmessage=""):
|
||||
f1 = row.csvfilename
|
||||
u = row.user.user
|
||||
r = getrower(u)
|
||||
|
||||
rowdata = rdata(f1)
|
||||
|
||||
hascoordinates = 1
|
||||
if rowdata != 0:
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user