Private
Public Access
1
0

Merge branch 'release/v4.27'

This commit is contained in:
Sander Roosendaal
2017-10-17 17:25:24 +02:00
5 changed files with 27 additions and 17 deletions
+6 -6
View File
@@ -72,19 +72,19 @@ class UploadOptionsForm(forms.Form):
initial='timeplot',
label='Plot Type')
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,
label='Upload to Strava')
label='Export to Strava')
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,
label='Upload to RunKeeper')
label='Export to RunKeeper')
upload_to_MapMyFitness = forms.BooleanField(initial=False,
required=False,
label='Upload to MapMyFitness')
label='Export to MapMyFitness')
upload_to_TrainingPeaks = forms.BooleanField(initial=False,
required=False,
label='Upload to TrainingPeaks')
label='Export to TrainingPeaks')
# do_physics = forms.BooleanField(initial=False,required=False,label='Power Estimate (OTW)')
makeprivate = forms.BooleanField(initial=False,required=False,
label='Make Workout Private')
+7 -4
View File
@@ -219,12 +219,13 @@ def interactive_boxchart(datadf,fieldname,extratitle=''):
return script,div
def interactive_activitychart(workouts,startdate,enddate):
def interactive_activitychart(workouts,startdate,enddate,stack='type'):
if len(workouts) == 0:
return "",""
dates = []
types = []
rowers = []
durations = []
for w in workouts:
@@ -234,6 +235,7 @@ def interactive_activitychart(workouts,startdate,enddate):
dates.append(dd)
durations.append(du)
types.append(w.workouttype)
rowers.append(w.user.user.first_name)
try:
d = utc.localize(startdate)
@@ -250,17 +252,18 @@ def interactive_activitychart(workouts,startdate,enddate):
dates.append(d.strftime('%m/%d'))
durations.append(0)
types.append('rower')
rowers.append('Sander')
d += datetime.timedelta(days=1)
df = pd.DataFrame({
'date':dates,
'duration':durations,
'type':types,
'rower':rowers,
})
p = Bar(df,'date',values='duration',title='Activity',
stack='type',
stack=stack,
plot_width=350,
plot_height=250,
toolbar_location = None,
@@ -270,7 +273,7 @@ def interactive_activitychart(workouts,startdate,enddate):
new_items = []
for legend_item in legend.items:
it = legend_item.label['value']
tot = df[df['type']==it].duration.sum()
tot = df[df[stack]==it].duration.sum()
if tot != 0:
new_items.append(legend_item)
legend.items = new_items
+1 -1
View File
@@ -36,7 +36,7 @@
</p>
<p>
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.
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>
+8 -2
View File
@@ -4416,9 +4416,15 @@ def workouts_view(request,message='',successmessage='',
"-id"
)
if theteam:
stack='rower'
else:
stack='type'
script,div = interactive_activitychart(g_workouts,
activity_startdate,
activity_enddate)
activity_enddate,
stack=stack)
messages.info(request,successmessage)
messages.error(request,message)
@@ -8191,7 +8197,7 @@ def workout_summary_edit_view(request,id,message="",successmessage=""
#intervalstats = rowdata.allstats()
if s:
try:
row.notes += u'{n} \n {s}'.format(
row.notes = u'{n} \n {s}'.format(
n = row.notes,
s = s
)
+3 -2
View File
@@ -5,6 +5,7 @@ import xml.etree.ElementTree as ET
import time
from datetime import datetime
from rowingdata import rowingdata,geo_distance
import arrow
import pandas as pd
from rowers.models import Rower, Workout
@@ -36,7 +37,7 @@ def get_weather_data(long,lat,unixtime):
# Get Metar data
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 += str(unixtime-3600)
@@ -122,7 +123,7 @@ def get_wind_data(lat,long,unixtime):
windspeed = windspeed*(0.1)**0.34
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 += '. Temperature '+str(temperature)+'F/'+str(temperaturec)+'C'