Merge branch 'release/v12.15'
This commit is contained in:
@@ -11,7 +11,7 @@ from .models import (
|
||||
Team,TeamInvite,TeamRequest,
|
||||
WorkoutComment,C2WorldClassAgePerformance,PlannedSession,
|
||||
GeoCourse,GeoPolygon,GeoPoint,VirtualRace,VirtualRaceResult,
|
||||
PaidPlan,IndoorVirtualRaceResult,
|
||||
PaidPlan,IndoorVirtualRaceResult,ShareKey
|
||||
)
|
||||
|
||||
# Register your models here so you can use them in the Admin module
|
||||
@@ -116,6 +116,9 @@ class GraphImageAdmin(admin.ModelAdmin):
|
||||
class GeoPolygonInline(admin.StackedInline):
|
||||
model = GeoPolygon
|
||||
|
||||
class ShareKeyAdmin(admin.ModelAdmin):
|
||||
list_display = ('location','creation_date','expiration_date')
|
||||
|
||||
|
||||
class GeoCourseAdmin(admin.ModelAdmin):
|
||||
list_display = ('manager','name')
|
||||
@@ -156,3 +159,4 @@ admin.site.register(VirtualRace, VirtualRaceAdmin)
|
||||
admin.site.register(VirtualRaceResult, VirtualRaceResultAdmin)
|
||||
admin.site.register(IndoorVirtualRaceResult, IndoorVirtualRaceResultAdmin)
|
||||
admin.site.register(PaidPlan,PaidPlanAdmin)
|
||||
admin.site.register(ShareKey,ShareKeyAdmin)
|
||||
|
||||
@@ -133,12 +133,17 @@ def get_video_data(w,groups=['basic'],mode='water'):
|
||||
columns = list(set(columns))
|
||||
df = getsmallrowdata_db(columns,ids=[w.id],
|
||||
workstrokesonly=False,doclean=False,compute=False)
|
||||
|
||||
|
||||
df['time'] = (df['time']-df['time'].min())/1000.
|
||||
|
||||
df.sort_values(by='time',inplace=True)
|
||||
|
||||
|
||||
df.set_index(pd.to_timedelta(df['time'],unit='s'),inplace=True)
|
||||
df2 = df.resample('1s').first().fillna(method='ffill')
|
||||
df2['time'] = df2.index.total_seconds()
|
||||
|
||||
if 'pace' in columns:
|
||||
df2['pace'] = df2['pace']/1000.
|
||||
p = df2['pace']
|
||||
@@ -177,6 +182,8 @@ def get_video_data(w,groups=['basic'],mode='water'):
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# bundle data
|
||||
data = {
|
||||
'boatspeed':boatspeed.values.tolist(),
|
||||
@@ -297,7 +304,7 @@ def get_latlon_time(id):
|
||||
return pd.DataFrame()
|
||||
|
||||
df = pd.DataFrame({
|
||||
'time': rowdata.df[' ElapsedTime (sec)'],
|
||||
'time': rowdata.df['TimeStamp (sec)']-rowdata.df['TimeStamp (sec)'].min(),
|
||||
'latitude': rowdata.df[' latitude'],
|
||||
'longitude': rowdata.df[' longitude']
|
||||
})
|
||||
|
||||
@@ -185,7 +185,10 @@ def create_c2_stroke_data_db(
|
||||
pace = 500.*totalseconds/distance
|
||||
|
||||
if workouttype in ['rower','slides','dynamic']:
|
||||
velo = distance/totalseconds
|
||||
try:
|
||||
velo = distance/totalseconds
|
||||
except ZeroDivisionError:
|
||||
velo = 0
|
||||
power = 2.8*velo**3
|
||||
else:
|
||||
power = 0
|
||||
|
||||
@@ -179,6 +179,8 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
||||
res = act.wait(poll_interval=5.0, timeout=60)
|
||||
except ActivityUploadFailed:
|
||||
failed = True
|
||||
except JSONDecodeError:
|
||||
failed = True
|
||||
if not failed:
|
||||
try:
|
||||
act = client.update_activity(res.id,activity_type=activity_type,
|
||||
@@ -730,6 +732,24 @@ def handle_calctrimp(id,
|
||||
normw = response.normw
|
||||
hrtss = response.hrtss
|
||||
|
||||
if np.isnan(tss):
|
||||
tss = 0
|
||||
|
||||
if np.isnan(normp):
|
||||
normp = 0
|
||||
|
||||
if np.isnan(trimp):
|
||||
trimp = 0
|
||||
|
||||
if np.isnan(normv):
|
||||
normv = 0
|
||||
|
||||
if np.isnan(normw):
|
||||
normw = 0
|
||||
|
||||
if np.isnan(hrtss):
|
||||
hrtss = 0
|
||||
|
||||
|
||||
query = 'UPDATE rowers_workout SET rscore = {tss}, normp = {normp}, trimp={trimp}, hrtss={hrtss}, normv={normv}, normw={normw} WHERE id={id}'.format(
|
||||
tss = int(tss),
|
||||
|
||||
Reference in New Issue
Block a user