Merge branch 'release/v12.05'
This commit is contained in:
@@ -102,6 +102,7 @@ import requests
|
|||||||
import rowers.longtask as longtask
|
import rowers.longtask as longtask
|
||||||
import arrow
|
import arrow
|
||||||
import stravalib
|
import stravalib
|
||||||
|
from stravalib.exc import ActivityUploadFailed
|
||||||
|
|
||||||
from rowers.utils import get_strava_stream
|
from rowers.utils import get_strava_stream
|
||||||
|
|
||||||
@@ -171,9 +172,14 @@ def handle_runkeeper_sync(workoutid,url,headers,data,debug=False,**kwargs):
|
|||||||
@app.task
|
@app.task
|
||||||
def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,description,debug=False,**kwargs):
|
def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,description,debug=False,**kwargs):
|
||||||
client = stravalib.Client(access_token=stravatoken)
|
client = stravalib.Client(access_token=stravatoken)
|
||||||
|
failed = False
|
||||||
with open(filename,'rb') as f:
|
with open(filename,'rb') as f:
|
||||||
act = client.upload_activity(f,'tcx.gz',name=name)
|
act = client.upload_activity(f,'tcx.gz',name=name)
|
||||||
|
try:
|
||||||
res = act.wait(poll_interval=5.0, timeout=60)
|
res = act.wait(poll_interval=5.0, timeout=60)
|
||||||
|
except ActivityUploadFailed:
|
||||||
|
failed = True
|
||||||
|
if not failed:
|
||||||
try:
|
try:
|
||||||
act = client.update_activity(res.id,activity_type=activity_type,
|
act = client.update_activity(res.id,activity_type=activity_type,
|
||||||
description=description,device_name='Rowsandall.com')
|
description=description,device_name='Rowsandall.com')
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<th align="left">Unit</th><td>{{ ps.sessionunit }}</td>
|
<th align="left">Unit</th><td>{{ ps.sessionunit }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left">Comment</th><td>{{ ps.comment|linebreaks }}</td>
|
<th align="left">Comment</th><td>{{ ps.comment|linebreaks|urlshorten:"50" }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|||||||
@@ -30,7 +30,7 @@
|
|||||||
{% if key == attr %}
|
{% if key == attr %}
|
||||||
<tr>
|
<tr>
|
||||||
{% if key == 'comment' %}
|
{% if key == 'comment' %}
|
||||||
<td><b>{{ value.0 }}</b></td><td class="wrapwords">{{ value.1|linebreaks }}</td>
|
<td><b>{{ value.0 }}</b></td><td class="wrapwords">{{ value.1|linebreaks|urlshorten:"50" }}</td>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td><b>{{ value.0 }}</b></td><td class="wrapwords">{{ value.1 }}</td>
|
<td><b>{{ value.0 }}</b></td><td class="wrapwords">{{ value.1 }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|||||||
Reference in New Issue
Block a user