Merge branch 'release/v4.27'
This commit is contained in:
+6
-6
@@ -72,19 +72,19 @@ class UploadOptionsForm(forms.Form):
|
|||||||
initial='timeplot',
|
initial='timeplot',
|
||||||
label='Plot Type')
|
label='Plot Type')
|
||||||
upload_to_C2 = forms.BooleanField(initial=False,required=False,
|
upload_to_C2 = forms.BooleanField(initial=False,required=False,
|
||||||
label='Upload to Concept2 logbook')
|
label='Export to Concept2 logbook')
|
||||||
upload_to_Strava = forms.BooleanField(initial=False,required=False,
|
upload_to_Strava = forms.BooleanField(initial=False,required=False,
|
||||||
label='Upload to Strava')
|
label='Export to Strava')
|
||||||
upload_to_SportTracks = forms.BooleanField(initial=False,required=False,
|
upload_to_SportTracks = forms.BooleanField(initial=False,required=False,
|
||||||
label='Upload to SportTracks')
|
label='Export to SportTracks')
|
||||||
upload_to_RunKeeper = forms.BooleanField(initial=False,required=False,
|
upload_to_RunKeeper = forms.BooleanField(initial=False,required=False,
|
||||||
label='Upload to RunKeeper')
|
label='Export to RunKeeper')
|
||||||
upload_to_MapMyFitness = forms.BooleanField(initial=False,
|
upload_to_MapMyFitness = forms.BooleanField(initial=False,
|
||||||
required=False,
|
required=False,
|
||||||
label='Upload to MapMyFitness')
|
label='Export to MapMyFitness')
|
||||||
upload_to_TrainingPeaks = forms.BooleanField(initial=False,
|
upload_to_TrainingPeaks = forms.BooleanField(initial=False,
|
||||||
required=False,
|
required=False,
|
||||||
label='Upload to TrainingPeaks')
|
label='Export to TrainingPeaks')
|
||||||
# do_physics = forms.BooleanField(initial=False,required=False,label='Power Estimate (OTW)')
|
# do_physics = forms.BooleanField(initial=False,required=False,label='Power Estimate (OTW)')
|
||||||
makeprivate = forms.BooleanField(initial=False,required=False,
|
makeprivate = forms.BooleanField(initial=False,required=False,
|
||||||
label='Make Workout Private')
|
label='Make Workout Private')
|
||||||
|
|||||||
@@ -219,12 +219,13 @@ def interactive_boxchart(datadf,fieldname,extratitle=''):
|
|||||||
return script,div
|
return script,div
|
||||||
|
|
||||||
|
|
||||||
def interactive_activitychart(workouts,startdate,enddate):
|
def interactive_activitychart(workouts,startdate,enddate,stack='type'):
|
||||||
if len(workouts) == 0:
|
if len(workouts) == 0:
|
||||||
return "",""
|
return "",""
|
||||||
|
|
||||||
dates = []
|
dates = []
|
||||||
types = []
|
types = []
|
||||||
|
rowers = []
|
||||||
durations = []
|
durations = []
|
||||||
|
|
||||||
for w in workouts:
|
for w in workouts:
|
||||||
@@ -234,6 +235,7 @@ def interactive_activitychart(workouts,startdate,enddate):
|
|||||||
dates.append(dd)
|
dates.append(dd)
|
||||||
durations.append(du)
|
durations.append(du)
|
||||||
types.append(w.workouttype)
|
types.append(w.workouttype)
|
||||||
|
rowers.append(w.user.user.first_name)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
d = utc.localize(startdate)
|
d = utc.localize(startdate)
|
||||||
@@ -250,17 +252,18 @@ def interactive_activitychart(workouts,startdate,enddate):
|
|||||||
dates.append(d.strftime('%m/%d'))
|
dates.append(d.strftime('%m/%d'))
|
||||||
durations.append(0)
|
durations.append(0)
|
||||||
types.append('rower')
|
types.append('rower')
|
||||||
|
rowers.append('Sander')
|
||||||
d += datetime.timedelta(days=1)
|
d += datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
|
||||||
df = pd.DataFrame({
|
df = pd.DataFrame({
|
||||||
'date':dates,
|
'date':dates,
|
||||||
'duration':durations,
|
'duration':durations,
|
||||||
'type':types,
|
'type':types,
|
||||||
|
'rower':rowers,
|
||||||
})
|
})
|
||||||
|
|
||||||
p = Bar(df,'date',values='duration',title='Activity',
|
p = Bar(df,'date',values='duration',title='Activity',
|
||||||
stack='type',
|
stack=stack,
|
||||||
plot_width=350,
|
plot_width=350,
|
||||||
plot_height=250,
|
plot_height=250,
|
||||||
toolbar_location = None,
|
toolbar_location = None,
|
||||||
@@ -270,7 +273,7 @@ def interactive_activitychart(workouts,startdate,enddate):
|
|||||||
new_items = []
|
new_items = []
|
||||||
for legend_item in legend.items:
|
for legend_item in legend.items:
|
||||||
it = legend_item.label['value']
|
it = legend_item.label['value']
|
||||||
tot = df[df['type']==it].duration.sum()
|
tot = df[df[stack]==it].duration.sum()
|
||||||
if tot != 0:
|
if tot != 0:
|
||||||
new_items.append(legend_item)
|
new_items.append(legend_item)
|
||||||
legend.items = new_items
|
legend.items = new_items
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
You can select one static plot to be generated immediately for
|
You can select one static plot to be generated immediately for
|
||||||
this workout. You can select to upload to major fitness
|
this workout. You can select to export to major fitness
|
||||||
platforms automatically.
|
platforms automatically.
|
||||||
If you check "make private", this workout will not be visible to your followers and will not show up in your teams' workouts list.
|
If you check "make private", this workout will not be visible to your followers and will not show up in your teams' workouts list.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
+8
-2
@@ -4416,9 +4416,15 @@ def workouts_view(request,message='',successmessage='',
|
|||||||
"-id"
|
"-id"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if theteam:
|
||||||
|
stack='rower'
|
||||||
|
else:
|
||||||
|
stack='type'
|
||||||
|
|
||||||
script,div = interactive_activitychart(g_workouts,
|
script,div = interactive_activitychart(g_workouts,
|
||||||
activity_startdate,
|
activity_startdate,
|
||||||
activity_enddate)
|
activity_enddate,
|
||||||
|
stack=stack)
|
||||||
|
|
||||||
messages.info(request,successmessage)
|
messages.info(request,successmessage)
|
||||||
messages.error(request,message)
|
messages.error(request,message)
|
||||||
@@ -8191,7 +8197,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
|
|||||||
#intervalstats = rowdata.allstats()
|
#intervalstats = rowdata.allstats()
|
||||||
if s:
|
if s:
|
||||||
try:
|
try:
|
||||||
row.notes += u'{n} \n {s}'.format(
|
row.notes = u'{n} \n {s}'.format(
|
||||||
n = row.notes,
|
n = row.notes,
|
||||||
s = s
|
s = s
|
||||||
)
|
)
|
||||||
|
|||||||
+5
-4
@@ -5,6 +5,7 @@ import xml.etree.ElementTree as ET
|
|||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from rowingdata import rowingdata,geo_distance
|
from rowingdata import rowingdata,geo_distance
|
||||||
|
import arrow
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
from rowers.models import Rower, Workout
|
from rowers.models import Rower, Workout
|
||||||
|
|
||||||
@@ -36,8 +37,8 @@ def get_weather_data(long,lat,unixtime):
|
|||||||
# Get Metar data
|
# Get Metar data
|
||||||
def get_metar_data(airportcode,unixtime):
|
def get_metar_data(airportcode,unixtime):
|
||||||
|
|
||||||
timestamp = datetime.utcfromtimestamp(unixtime).isoformat()+'Z'
|
timestamp = arrow.get(unixtime).isoformat()
|
||||||
|
|
||||||
url = "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&startTime="
|
url = "https://www.aviationweather.gov/adds/dataserver_current/httpparam?dataSource=metars&requestType=retrieve&format=xml&startTime="
|
||||||
url += str(unixtime-3600)
|
url += str(unixtime-3600)
|
||||||
url += "&endTime="
|
url += "&endTime="
|
||||||
@@ -122,8 +123,8 @@ def get_wind_data(lat,long,unixtime):
|
|||||||
windspeed = windspeed*(0.1)**0.34
|
windspeed = windspeed*(0.1)**0.34
|
||||||
windspeed = 0.01*int(100*windspeed)
|
windspeed = 0.01*int(100*windspeed)
|
||||||
|
|
||||||
timestamp = datetime.utcfromtimestamp(unixtime).isoformat()+'Z'
|
timestamp = arrow.get(unixtime).isoformat()
|
||||||
|
|
||||||
message = 'Summary for your location at '+timestamp+': '+summary
|
message = 'Summary for your location at '+timestamp+': '+summary
|
||||||
message += '. Temperature '+str(temperature)+'F/'+str(temperaturec)+'C'
|
message += '. Temperature '+str(temperature)+'F/'+str(temperaturec)+'C'
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user