Merge branch 'develop' into feature/restapi2
This commit is contained in:
@@ -518,7 +518,7 @@ def dataprep(rowdatadf,id=0,bands=True,barchart=True,otwpower=True,
|
|||||||
try:
|
try:
|
||||||
drivespeed = drivelength/rowdatadf[' DriveTime (ms)']*1.0e3
|
drivespeed = drivelength/rowdatadf[' DriveTime (ms)']*1.0e3
|
||||||
except TypeError:
|
except TypeError:
|
||||||
drivespeed = 0.0*rowdatadf['TimeStam (sec)']
|
drivespeed = 0.0*rowdatadf['TimeStamp (sec)']
|
||||||
|
|
||||||
drivespeed = drivespeed.fillna(value=0)
|
drivespeed = drivespeed.fillna(value=0)
|
||||||
driveenergy = drivelength*averageforce*4.44822
|
driveenergy = drivelength*averageforce*4.44822
|
||||||
|
|||||||
@@ -532,5 +532,11 @@ class SiteAnnouncement(models.Model):
|
|||||||
self.expires = timezone.now()+datetime.timedelta(days=10)
|
self.expires = timezone.now()+datetime.timedelta(days=10)
|
||||||
self.modified = timezone.now()
|
self.modified = timezone.now()
|
||||||
if self.dotweet:
|
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)
|
return super(SiteAnnouncement,self).save(*args, **kwargs)
|
||||||
|
|||||||
@@ -247,13 +247,20 @@ def createstravaworkoutdata(w):
|
|||||||
def handle_stravaexport(file,workoutname,stravatoken,description=''):
|
def handle_stravaexport(file,workoutname,stravatoken,description=''):
|
||||||
# w = Workout.objects.get(id=workoutid)
|
# w = Workout.objects.get(id=workoutid)
|
||||||
client = stravalib.Client(access_token=stravatoken)
|
client = stravalib.Client(access_token=stravatoken)
|
||||||
|
try:
|
||||||
act = client.upload_activity(file,'tcx',name=workoutname)
|
act = client.upload_activity(file,'tcx',name=workoutname)
|
||||||
res = act.wait(poll_interval=5.0)
|
res = act.wait(poll_interval=5.0)
|
||||||
|
|
||||||
|
|
||||||
# description doesn't work yet. Have to wait for stravalib to update
|
# description doesn't work yet. Have to wait for stravalib to update
|
||||||
act = client.update_activity(res.id,activity_type='Rowing',description=description)
|
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
|
# w.uploadedtostrava = res.id
|
||||||
|
|||||||
@@ -130,6 +130,10 @@ You will be taken to the secure PayPal payment site.
|
|||||||
"instructions to seller".</li>
|
"instructions to seller".</li>
|
||||||
</ul>
|
</ul>
|
||||||
</p>
|
</p>
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
|
||||||
<input type="hidden" name="cmd" value="_s-xclick">
|
<input type="hidden" name="cmd" value="_s-xclick">
|
||||||
|
|||||||
@@ -158,7 +158,7 @@
|
|||||||
<div class="grid_2 alpha">
|
<div class="grid_2 alpha">
|
||||||
<p id="footer"><a href="/rowers/email/">© Sander Roosendaal</a></p>
|
<p id="footer"><a href="/rowers/email/">© Sander Roosendaal</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_1 prefix_1">
|
<div class="grid_1">
|
||||||
<p id="footer">
|
<p id="footer">
|
||||||
<a href="/rowers/about">About</a></p>
|
<a href="/rowers/about">About</a></p>
|
||||||
</div>
|
</div>
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
<p id="footer">
|
<p id="footer">
|
||||||
<a href="/rowers/legal">Legal</a></p>
|
<a href="/rowers/legal">Legal</a></p>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_1 prefix_1">
|
<div class="grid_1">
|
||||||
<p id="footer">
|
<p id="footer">
|
||||||
<a href="/rowers/physics">Physics</a></p>
|
<a href="/rowers/physics">Physics</a></p>
|
||||||
</div>
|
</div>
|
||||||
@@ -178,7 +178,10 @@
|
|||||||
<p id="footer">
|
<p id="footer">
|
||||||
<a href="/rowers/videos">Videos</a></p>
|
<a href="/rowers/videos">Videos</a></p>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid_2">
|
||||||
|
<p id="footer">
|
||||||
|
<a href="http://analytics.rowsandall.com/">Rowing Analytics BLOG</a></p>
|
||||||
|
</div>
|
||||||
<div class="grid_1 omega">
|
<div class="grid_1 omega">
|
||||||
<p id="footer">
|
<p id="footer">
|
||||||
<a href="/rowers/email">Contact</a></p>
|
<a href="/rowers/email">Contact</a></p>
|
||||||
|
|||||||
@@ -118,13 +118,22 @@
|
|||||||
|
|
||||||
<p>Standard <a href="https://oauth.net/2/">Oauth2</a> authentication.
|
<p>Standard <a href="https://oauth.net/2/">Oauth2</a> authentication.
|
||||||
Get authorization code by pointing your user to the authorization URL.
|
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.</p>
|
use the refresh token to refresh it.</p>
|
||||||
|
|
||||||
|
<p>The POST call must have content-type: <i>x-www-form-urlencoded</i>.
|
||||||
|
I set it this way to support the handy testing utility mentioned
|
||||||
|
belower. However,
|
||||||
|
I really would like to support <i>application/json</i> 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.</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li>Authorization URL: <b>https://rowsandall.com/rowers/o/authorize</b></li>
|
<li>Authorization URL: <b>https://rowsandall.com/rowers/o/authorize</b></li>
|
||||||
<li>Access Token request: <b>https://rowsandall.com/rowers/o/token/</b></li>
|
<li>Access Token request: <b>https://rowsandall.com/rowers/o/token/</b></li>
|
||||||
<li>Access Token refresh: <b>https://rowsandall.com/rowers/o/token/</b></li>
|
<li>Access Token refresh: <b>https://rowsandall.com/rowers/o/token/</b></li>
|
||||||
|
<li>Handy utility for testing: <b><a href="http://django-oauth-toolkit.herokuapp.com/consumer/">http://django-oauth-toolkit.herokuapp.com/consumer/</a></b></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h6>API documentation</h6>
|
<h6>API documentation</h6>
|
||||||
|
|||||||
@@ -35,6 +35,10 @@ You will be taken to the secure PayPal payment site.
|
|||||||
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<p>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.</p>
|
||||||
|
|
||||||
<p>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.</p>
|
<p>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.</p>
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ from rowingdata import rower as rrower
|
|||||||
from rowingdata import main as rmain
|
from rowingdata import main as rmain
|
||||||
from rowingdata import rowingdata as rrdata
|
from rowingdata import rowingdata as rrdata
|
||||||
from rowingdata import TCXParser,RowProParser,ErgDataParser,TCXParserNoHR
|
from rowingdata import TCXParser,RowProParser,ErgDataParser,TCXParserNoHR
|
||||||
from rowingdata import BoatCoachParser
|
from rowingdata import BoatCoachParser,RowPerfectParser
|
||||||
from rowingdata import MysteryParser
|
from rowingdata import MysteryParser
|
||||||
from rowingdata import painsledDesktopParser,speedcoachParser,ErgStickParser
|
from rowingdata import painsledDesktopParser,speedcoachParser,ErgStickParser
|
||||||
from rowingdata import SpeedCoach2Parser,FITParser,fitsummarydata
|
from rowingdata import SpeedCoach2Parser,FITParser,fitsummarydata
|
||||||
@@ -934,9 +934,17 @@ def workout_strava_upload_view(request,id=0):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
with open(tcxfile,'rb') as f:
|
with open(tcxfile,'rb') as f:
|
||||||
res = stravastuff.handle_stravaexport(f,w.name,
|
try:
|
||||||
r.stravatoken,
|
res = stravastuff.handle_stravaexport(f,w.name,
|
||||||
description=w.notes)
|
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.uploadedtostrava = res
|
||||||
w.save()
|
w.save()
|
||||||
@@ -3752,6 +3760,13 @@ def workout_upload_view(request,message=""):
|
|||||||
response = HttpResponseRedirect(url)
|
response = HttpResponseRedirect(url)
|
||||||
return response
|
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':
|
if fileformat == 'unknown':
|
||||||
message = "We couldn't recognize the file type"
|
message = "We couldn't recognize the file type"
|
||||||
url = reverse(workout_upload_view,
|
url = reverse(workout_upload_view,
|
||||||
@@ -3782,6 +3797,10 @@ def workout_upload_view(request,message=""):
|
|||||||
if (fileformat == 'mystery'):
|
if (fileformat == 'mystery'):
|
||||||
row = MysteryParser(f2)
|
row = MysteryParser(f2)
|
||||||
|
|
||||||
|
# handle RowPerfect
|
||||||
|
if (fileformat == 'rowperfect3'):
|
||||||
|
row = RowPerfectParser(f2)
|
||||||
|
|
||||||
# handle TCX no HR
|
# handle TCX no HR
|
||||||
if (fileformat == 'tcxnohr'):
|
if (fileformat == 'tcxnohr'):
|
||||||
row = TCXParserNoHR(f2)
|
row = TCXParserNoHR(f2)
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ GMAPIKEY = "AIzaSyAgu1w9QSthaGPMLp8y9JedPoMc9sfEgJ8"
|
|||||||
OAUTH2_PROVIDER = {
|
OAUTH2_PROVIDER = {
|
||||||
# this is the list of available scopes
|
# this is the list of available scopes
|
||||||
'SCOPES': {'read': 'Read scope', 'write': 'Write scope', 'groups': 'Access to your groups'},
|
'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'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -27,15 +27,9 @@ from rowers import views as rowersviews
|
|||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^admin/', admin.site.urls),
|
url(r'^admin/', admin.site.urls),
|
||||||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||||
# url('^', include('django.contrib.auth.urls')),
|
|
||||||
url(r'^$',rootview),
|
url(r'^$',rootview),
|
||||||
url(r'^version/$',version),
|
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'^addresult/(.+.*)/$',wait),
|
||||||
# url(r'^waitforplot/(.+.*)/$',waitforplot),
|
|
||||||
# url(r'^showplot/(.+.*)/$',showplot),
|
|
||||||
url(r'^login/',auth_views.login, name='login'),
|
url(r'^login/',auth_views.login, name='login'),
|
||||||
url(r'^logout/',auth_views.logout_then_login,name='logout'),
|
url(r'^logout/',auth_views.logout_then_login,name='logout'),
|
||||||
url(r'^password_change_done/$',auth_views.password_change_done,name='password_change_done'),
|
url(r'^password_change_done/$',auth_views.password_change_done,name='password_change_done'),
|
||||||
|
|||||||
Reference in New Issue
Block a user