diff --git a/rowers/forms.py b/rowers/forms.py index eecde602..1e9974e2 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -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') diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index 2cc207c0..29675cd0 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -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 diff --git a/rowers/templates/document_form.html b/rowers/templates/document_form.html index 6c316df4..53a2c06d 100644 --- a/rowers/templates/document_form.html +++ b/rowers/templates/document_form.html @@ -36,7 +36,7 @@

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.

diff --git a/rowers/views.py b/rowers/views.py index 3e7f3d38..208239cc 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -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 ) diff --git a/rowers/weather.py b/rowers/weather.py index 9acf5154..3e9bd4e0 100644 --- a/rowers/weather.py +++ b/rowers/weather.py @@ -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,8 +37,8 @@ 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) url += "&endTime=" @@ -122,8 +123,8 @@ 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'