diff --git a/rowers/dataprep.py b/rowers/dataprep.py index 9744b6b9..b6dbad35 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -518,7 +518,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True, try: drivespeed = drivelength/rowdatadf[' DriveTime (ms)']*1.0e3 except TypeError: - drivespeed = 0.0*rowdatadf['TimeStam (sec)'] + drivespeed = 0.0*rowdatadf['TimeStamp (sec)'] drivespeed = drivespeed.fillna(value=0) driveenergy = drivelength*averageforce*4.44822 diff --git a/rowers/models.py b/rowers/models.py index 878929b4..303b4b76 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -532,5 +532,11 @@ class SiteAnnouncement(models.Model): self.expires = timezone.now()+datetime.timedelta(days=10) self.modified = timezone.now() if self.dotweet: - status = tweetapi.PostUpdate(self.announcement) + try: + status = tweetapi.PostUpdate(self.announcement) + except: + try: + status = tweetapi.PostUpdate(self.announcement[:135]) + except: + pass return super(SiteAnnouncement,self).save(*args, **kwargs) diff --git a/rowers/stravastuff.py b/rowers/stravastuff.py index 954f4dee..bc3c354f 100644 --- a/rowers/stravastuff.py +++ b/rowers/stravastuff.py @@ -247,13 +247,20 @@ def createstravaworkoutdata(w): def handle_stravaexport(file,workoutname,stravatoken,description=''): # w = Workout.objects.get(id=workoutid) client = stravalib.Client(access_token=stravatoken) - - act = client.upload_activity(file,'tcx',name=workoutname) - res = act.wait(poll_interval=5.0) + try: + act = client.upload_activity(file,'tcx',name=workoutname) + res = act.wait(poll_interval=5.0) - # description doesn't work yet. Have to wait for stravalib to update - act = client.update_activity(res.id,activity_type='Rowing',description=description) + # description doesn't work yet. Have to wait for stravalib to update + act = client.update_activity(res.id,activity_type='Rowing',description=description) + except: + with open("media/stravaerrors.log","a") as errorlog: + errorstring = str(sys.exc_info()[0]) + timestr = time.strftime("%Y%m%d-%H%M%S") + errorlog.write(timestr+errorstring+"\r\n") + errorlog.write("stravastuff.py line 262\r\n") + # w.uploadedtostrava = res.id diff --git a/rowers/templates/about_us.html b/rowers/templates/about_us.html index e562c356..a57e5e3a 100644 --- a/rowers/templates/about_us.html +++ b/rowers/templates/about_us.html @@ -130,6 +130,10 @@ You will be taken to the secure PayPal payment site. "instructions to seller".

+

After you do the payment, we will manually change your membership to + "Pro". Depending on our availability, this may take some time + (typically one working day). Don't hesitate to contact us + if you have any questions at this stage.

diff --git a/rowers/templates/base.html b/rowers/templates/base.html index 2b209f35..1f583a2f 100644 --- a/rowers/templates/base.html +++ b/rowers/templates/base.html @@ -158,7 +158,7 @@
-
+ @@ -170,7 +170,7 @@
-
+ @@ -178,7 +178,10 @@
- +
+ +
diff --git a/rowers/templates/developers.html b/rowers/templates/developers.html index f383230a..e2907195 100644 --- a/rowers/templates/developers.html +++ b/rowers/templates/developers.html @@ -118,13 +118,22 @@

Standard Oauth2 authentication. Get authorization code by pointing your user to the authorization URL. - Exchange authorization code for an access token. When access token expires, + Exchange authorization code for an access token. When access token + expires, use the refresh token to refresh it.

+

The POST call must have content-type: x-www-form-urlencoded. + I set it this way to support the handy testing utility mentioned + belower. However, + I really would like to support application/json but with the + current framework I cannot support both at the same time. Expect + changes. Write to me if you want to be notified of changes.

+
API documentation
diff --git a/rowers/templates/promembership.html b/rowers/templates/promembership.html index e23217aa..41d31a5b 100644 --- a/rowers/templates/promembership.html +++ b/rowers/templates/promembership.html @@ -35,10 +35,14 @@ You will be taken to the secure PayPal payment site. +

After you do the payment, we will manually change your membership to + "Pro". Depending on our availability, this may take some time + (typically one working day). Don't hesitate to contact us + if you have any questions at this stage.

If, for any reason, you are not happy with your Pro membership, please let me know through the contact form. I will contact you as soon as possible to discuss how we can make things better.

- {% endblock content %} \ No newline at end of file + {% endblock content %} diff --git a/rowers/views.py b/rowers/views.py index 8a7d8cf3..167ecb92 100644 --- a/rowers/views.py +++ b/rowers/views.py @@ -58,7 +58,7 @@ from rowingdata import rower as rrower from rowingdata import main as rmain from rowingdata import rowingdata as rrdata from rowingdata import TCXParser,RowProParser,ErgDataParser,TCXParserNoHR -from rowingdata import BoatCoachParser +from rowingdata import BoatCoachParser,RowPerfectParser from rowingdata import MysteryParser from rowingdata import painsledDesktopParser,speedcoachParser,ErgStickParser from rowingdata import SpeedCoach2Parser,FITParser,fitsummarydata @@ -934,9 +934,17 @@ def workout_strava_upload_view(request,id=0): try: with open(tcxfile,'rb') as f: - res = stravastuff.handle_stravaexport(f,w.name, - r.stravatoken, - description=w.notes) + try: + res = stravastuff.handle_stravaexport(f,w.name, + r.stravatoken, + description=w.notes) + except: + with open("media/stravaerrors.log","a") as errorlog: + errorstring = str(sys.exc_info()[0]) + timestr = time.strftime("%Y%m%d-%H%M%S") + errorlog.write(timestr+errorstring+"\r\n") + errorlog.write("views.py line 946\r\n") + w.uploadedtostrava = res w.save() @@ -3751,6 +3759,13 @@ def workout_upload_view(request,message=""): args=[str(message)]) response = HttpResponseRedirect(url) return response + + if fileformat == 'rowprolog': + message = "This RowPro logbook summary does not contain stroke data. Please use the Stroke Data CSV file for the individual workout in your log." + url = reverse(workout_upload_view, + args=[str(message)]) + response = HttpResponseRedirect(url) + return response if fileformat == 'unknown': message = "We couldn't recognize the file type" @@ -3782,6 +3797,10 @@ def workout_upload_view(request,message=""): if (fileformat == 'mystery'): row = MysteryParser(f2) + # handle RowPerfect + if (fileformat == 'rowperfect3'): + row = RowPerfectParser(f2) + # handle TCX no HR if (fileformat == 'tcxnohr'): row = TCXParserNoHR(f2) diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py index c7af4887..58078fa3 100644 --- a/rowsandall_app/settings.py +++ b/rowsandall_app/settings.py @@ -262,7 +262,7 @@ GMAPIKEY = "AIzaSyAgu1w9QSthaGPMLp8y9JedPoMc9sfEgJ8" OAUTH2_PROVIDER = { # this is the list of available scopes 'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'}, - 'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore' + # 'OAUTH2_BACKEND_CLASS': 'oauth2_provider.oauth2_backends.JSONOAuthLibCore' } diff --git a/rowsandall_app/urls.py b/rowsandall_app/urls.py index 6db8318d..3415cd36 100644 --- a/rowsandall_app/urls.py +++ b/rowsandall_app/urls.py @@ -27,15 +27,9 @@ from rowers import views as rowersviews urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), -# url('^', include('django.contrib.auth.urls')), url(r'^$',rootview), url(r'^version/$',version), -# url(r'^rowingdata/$',rowingdata,{'formloc':'/rowingdata/'}), -# url(r'^nrowingdata/$',nrowingdata,{'formloc':'/nrowingdata/'}), -# url(r'^upload/$',uploadfile,{'formloc':'/upload/'}), url(r'^addresult/(.+.*)/$',wait), -# url(r'^waitforplot/(.+.*)/$',waitforplot), -# url(r'^showplot/(.+.*)/$',showplot), url(r'^login/',auth_views.login, name='login'), url(r'^logout/',auth_views.logout_then_login,name='logout'), url(r'^password_change_done/$',auth_views.password_change_done,name='password_change_done'),