Merge branch 'release/v15.50'
This commit is contained in:
@@ -147,7 +147,7 @@ def add_stroke_data(user,c2id,workoutid,startdatetime,csvfilename,
|
||||
s = "Token expired. Needs to refresh."
|
||||
return custom_exception_handler(401,s)
|
||||
else:
|
||||
starttimeunix = arrow.get(startdatetime).timestamp
|
||||
starttimeunix = arrow.get(startdatetime).timestamp()
|
||||
|
||||
job = myqueue(queue,
|
||||
handle_c2_import_stroke_data,
|
||||
@@ -212,7 +212,8 @@ def get_c2_workouts(rower,do_async=True):
|
||||
rower.user.id,
|
||||
rower.c2token,
|
||||
c2id,
|
||||
counter
|
||||
counter,
|
||||
rower.defaulttimezone
|
||||
)
|
||||
#res = handle_c2_async_workout(alldata,rower.user.id,rower.c2token,c2id,counter)
|
||||
counter = counter+1
|
||||
@@ -296,7 +297,7 @@ def create_async_workout(alldata,user,c2id):
|
||||
cum_time = res[0]
|
||||
lapidx = res[1]
|
||||
|
||||
starttimeunix = arrow.get(startdatetime).timestamp
|
||||
starttimeunix = arrow.get(startdatetime).timestamp()
|
||||
starttimeunix = starttimeunix-cum_time.max()
|
||||
|
||||
unixtime = cum_time+starttimeunix
|
||||
@@ -1194,7 +1195,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
except KeyError:
|
||||
comments = ''
|
||||
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
|
||||
res = make_cumvalues(0.1*strokedata['t'])
|
||||
cum_time = res[0]
|
||||
|
||||
@@ -1401,7 +1401,7 @@ def create_row_df(r,distance,duration,startdatetime,workouttype='rower',
|
||||
if nr_strokes == 0:
|
||||
nr_strokes = 100
|
||||
|
||||
unixstarttime = arrow.get(startdatetime).timestamp
|
||||
unixstarttime = arrow.get(startdatetime).timestamp()
|
||||
|
||||
|
||||
if not avgspm:
|
||||
@@ -2286,7 +2286,7 @@ def new_workout_from_df(r, df,
|
||||
df.rename(columns=columndict, inplace=True)
|
||||
|
||||
#starttimeunix = mktime(startdatetime.utctimetuple())
|
||||
starttimeunix = arrow.get(startdatetime).timestamp
|
||||
starttimeunix = arrow.get(startdatetime).timestamp()
|
||||
df[' ElapsedTime (sec)'] = df['TimeStamp (sec)']
|
||||
|
||||
df['TimeStamp (sec)'] = df['TimeStamp (sec)'] + starttimeunix
|
||||
@@ -2531,6 +2531,8 @@ def read_cols_df_sql(ids, columns, convertnewtons=True):
|
||||
columns = list(set(columns))
|
||||
ids = [int(id) for id in ids]
|
||||
|
||||
df = pd.DataFrame()
|
||||
|
||||
|
||||
if len(ids) == 0:
|
||||
return pd.DataFrame(),extracols
|
||||
|
||||
@@ -181,8 +181,8 @@ def imports_do_refresh_token(refreshtoken,oauth_data,access_token=''):
|
||||
expires_in = token_json['expires_in']
|
||||
except KeyError:
|
||||
try:
|
||||
expires_at = arrow.get(token_json['expires_at']).timestamp
|
||||
expires_in = expires_at - arrow.now().timestamp
|
||||
expires_at = arrow.get(token_json['expires_at']).timestamp()
|
||||
expires_in = expires_at - arrow.now().timestamp()
|
||||
except KeyError:
|
||||
expires_in = 0
|
||||
try:
|
||||
|
||||
@@ -111,6 +111,9 @@ class UserFullnameChoiceField(forms.ModelChoiceField):
|
||||
def label_from_instance(self,obj):
|
||||
return obj.get_full_name()
|
||||
|
||||
class PlannedSessionStepField(models.TextField):
|
||||
pass
|
||||
|
||||
# model for configurable template field
|
||||
class TemplateListField(models.TextField):
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -374,7 +374,7 @@ def add_workout_from_data(user,importid,data,strokedata,source='runkeeper',
|
||||
except:
|
||||
rowdatetime = datetime.strptime(data['date'],"%Y-%m-%d %H:%M:%S")
|
||||
rowdatetime = thetimezone.localize(rowdatetime).astimezone(utc)
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
#starttimeunix = mktime(rowdatetime.utctimetuple())
|
||||
starttimeunix += utcoffset*3600
|
||||
|
||||
|
||||
@@ -350,7 +350,7 @@ def add_workout_from_data(user,importid,data,strokedata,source='sporttracks',
|
||||
except:
|
||||
rowdatetime = datetime.datetime.strptime(data['date'],"%Y-%m-%d %H:%M:%S")
|
||||
rowdatetime = thetimezone.localize(rowdatetime).astimezone(utc)
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
|
||||
try:
|
||||
title = data['name']
|
||||
|
||||
@@ -350,7 +350,7 @@ def create_async_workout(alldata,user,stravaid,debug=False):
|
||||
|
||||
# Check if workout has stroke data, and get the stroke data
|
||||
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
|
||||
result = handle_strava_import_stroke_data(
|
||||
title,
|
||||
@@ -630,7 +630,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
except:
|
||||
title = ''
|
||||
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
|
||||
res = make_cumvalues(0.1*strokedata['t'])
|
||||
cum_time = res[0]
|
||||
|
||||
@@ -2951,7 +2951,7 @@ def handle_rp3_async_workout(userid,rp3token,rp3id,startdatetime,debug=False,**k
|
||||
return workoutid
|
||||
|
||||
@app.task
|
||||
def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,debug=False,**kwargs):
|
||||
def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,defaulttimezone,debug=False,**kwargs):
|
||||
time.sleep(delaysec)
|
||||
data = alldata[c2id]
|
||||
splitdata = None
|
||||
@@ -2986,7 +2986,7 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,debug=False,**k
|
||||
try:
|
||||
timezone_str = tz(data['timezone'])
|
||||
except:
|
||||
timezone_str = 'UTC'
|
||||
timezone_str = defaulttimezone
|
||||
|
||||
workoutdate = startdatetime.astimezone(
|
||||
pytz.timezone(timezone_str)
|
||||
@@ -3021,7 +3021,7 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,debug=False,**k
|
||||
cum_time = res[0]
|
||||
lapidx = res[1]
|
||||
|
||||
starttimeunix = arrow.get(startdatetime).timestamp
|
||||
starttimeunix = arrow.get(startdatetime).timestamp()
|
||||
starttimeunix = starttimeunix-cum_time.max()
|
||||
|
||||
unixtime = cum_time+starttimeunix
|
||||
@@ -3141,7 +3141,7 @@ def handle_c2_async_workout(alldata,userid,c2token,c2id,delaysec,debug=False,**k
|
||||
|
||||
# set distance, time
|
||||
query = "UPDATE `rowers_workout` SET `distance` = '%s', `duration` = '%s' WHERE `id` = '%s'" % (distance, duration, workoutid)
|
||||
|
||||
|
||||
with engine.connect() as conn, conn.begin():
|
||||
result = conn.execute(query)
|
||||
|
||||
@@ -3357,7 +3357,7 @@ def fetch_strava_workout(stravatoken,oauth_data,stravaid,csvfilename,userid,debu
|
||||
except:
|
||||
title = ''
|
||||
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
|
||||
res = make_cumvalues(0.1*strokedata['t'])
|
||||
cum_time = res[0]
|
||||
|
||||
@@ -924,7 +924,7 @@ def mocked_requests(*args, **kwargs):
|
||||
"token_type": "Bearer",
|
||||
"access_token": "987654321234567898765432123456789",
|
||||
"refresh_token": "1234567898765432112345678987654321",
|
||||
"expires_at": arrow.now().timestamp+3600
|
||||
"expires_at": arrow.now().timestamp()+7200
|
||||
}
|
||||
return MockResponse(json_data,200)
|
||||
|
||||
|
||||
@@ -126,7 +126,7 @@ def createunderarmourworkoutdata(w):
|
||||
#t = row.df.loc[:,'TimeStamp (sec)'].values-10*row.df.ix[0,'TimeStamp (sec)']
|
||||
t = row.df.loc[:,'TimeStamp (sec)'].values #-row.df.ix[0,'TimeStamp (sec)']
|
||||
|
||||
# t += arrow.get(st).timestamp
|
||||
# t += arrow.get(st).timestamp()
|
||||
|
||||
# t[0] = t[1]
|
||||
|
||||
@@ -405,7 +405,7 @@ def add_workout_from_data(user,importid,data,strokedata,
|
||||
except:
|
||||
rowdatetime = datetime.strptime(data['date'],"%Y-%m-%d %H:%M:%S")
|
||||
rowdatetime = thetimezone.localize(rowdatetime).astimezone(utc)
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
|
||||
|
||||
try:
|
||||
|
||||
@@ -2188,7 +2188,7 @@ def rankings_view2(request,userid=0,
|
||||
if userid == 0:
|
||||
userid = request.user.id
|
||||
else:
|
||||
lastupdated = "01-01-1900"
|
||||
lastupdated = "1900-01-01"
|
||||
|
||||
|
||||
promember=0
|
||||
@@ -2198,7 +2198,7 @@ def rankings_view2(request,userid=0,
|
||||
wcdurations = []
|
||||
wcpower = []
|
||||
|
||||
lastupdated = "01-01-1900"
|
||||
lastupdated = "1900-01-01"
|
||||
userid = 0
|
||||
if 'options' in request.session:
|
||||
options = request.session['options']
|
||||
@@ -2217,8 +2217,8 @@ def rankings_view2(request,userid=0,
|
||||
|
||||
|
||||
|
||||
lastupdatedtime = arrow.get(lastupdated).timestamp
|
||||
current_time = arrow.utcnow().timestamp
|
||||
lastupdatedtime = arrow.get(lastupdated).timestamp()
|
||||
current_time = arrow.utcnow().timestamp()
|
||||
|
||||
deltatime_seconds = current_time - lastupdatedtime
|
||||
recalc = False
|
||||
|
||||
@@ -240,7 +240,7 @@ def workout_csvemail_view(request,id=0):
|
||||
filename = code+'.csv'
|
||||
|
||||
rowdate = rowdata.rowdatetime
|
||||
starttimeunix = arrow.get(rowdate).timestamp
|
||||
starttimeunix = arrow.get(rowdate).timestamp()
|
||||
df = rowdata.df
|
||||
|
||||
try:
|
||||
|
||||
@@ -1319,7 +1319,7 @@ def add_workout_from_strokedata(user,importid,data,strokedata,
|
||||
except:
|
||||
title = ''
|
||||
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp
|
||||
starttimeunix = arrow.get(rowdatetime).timestamp()
|
||||
|
||||
res = make_cumvalues(0.1*strokedata['t'])
|
||||
cum_time = res[0]
|
||||
|
||||
@@ -2613,7 +2613,7 @@ def workout_downloadwind_view(request,id=0,
|
||||
startdatetime = dateutil.parser.parse("{}, {}".format(row.date,
|
||||
row.starttime))
|
||||
|
||||
starttimeunix = int(arrow.get(row.startdatetime).timestamp)
|
||||
starttimeunix = int(arrow.get(row.startdatetime).timestamp())
|
||||
#starttimeunix = int(mktime(startdatetime.utctimetuple()))
|
||||
avgtime = starttimeunix+avgtime
|
||||
winddata = get_wind_data(avglat,avglon,avgtime)
|
||||
@@ -2682,7 +2682,7 @@ def workout_downloadmetar_view(request,id=0,
|
||||
startdatetime = dateutil.parser.parse("{}, {}".format(row.date,
|
||||
row.starttime))
|
||||
|
||||
starttimeunix = arrow.get(row.startdatetime).timestamp
|
||||
starttimeunix = arrow.get(row.startdatetime).timestamp()
|
||||
#starttimeunix = int(mktime(startdatetime.utctimetuple()))
|
||||
avgtime = starttimeunix +avgtime
|
||||
winddata = get_metar_data(airportcode,avgtime)
|
||||
@@ -3243,7 +3243,7 @@ def workout_erase_column_view(request, id=0,column=''):
|
||||
|
||||
|
||||
row.write_csv(w.csvfilename,gzip=True)
|
||||
|
||||
|
||||
|
||||
row,workout = dataprep.getrowdata(id=w.id)
|
||||
datadf = dataprep.dataprep(row.df,id=w.id)
|
||||
|
||||
Reference in New Issue
Block a user