Merge branch 'release/v7.29'
This commit is contained in:
@@ -619,10 +619,10 @@ def handle_calctrimp(id,
|
||||
normw = 0
|
||||
|
||||
|
||||
if np.isnan(normv):
|
||||
if not np.isfinite(normv):
|
||||
normv = 500./120.
|
||||
|
||||
if np.isnan(normw):
|
||||
if not np.isfinite(normw):
|
||||
normw = 0
|
||||
|
||||
query = 'UPDATE rowers_workout SET rscore = {tss}, normp = {normp}, trimp={trimp}, hrtss={hrtss}, normv={normv}, normw={normw} WHERE id={id}'.format(
|
||||
|
||||
@@ -9694,37 +9694,12 @@ def workout_getsporttracksworkout_all(request):
|
||||
# Imports all new workouts from SportTracks
|
||||
@login_required()
|
||||
def workout_getstravaworkout_all(request):
|
||||
res = stravastuff.get_strava_workout_list(request.user)
|
||||
if (res.status_code == 200):
|
||||
r = getrower(request.user)
|
||||
stravaids = [int(item['id']) for item in res.json()]
|
||||
knownstravaids = uniqify([
|
||||
w.uploadedtostrava for w in Workout.objects.filter(user=r)
|
||||
])
|
||||
newids = [stravaid for stravaid in stravaids if not stravaid in knownstravaids]
|
||||
|
||||
for stravaid in newids:
|
||||
res = stravastuff.get_strava_workout(request.user,stravaid)
|
||||
strokedata = res[1]
|
||||
data = res[0]
|
||||
|
||||
if data:
|
||||
id,message = add_workout_from_strokedata(
|
||||
request.user,stravaid,data,strokedata,
|
||||
source='strava',
|
||||
workoutsource='strava')
|
||||
|
||||
if id==0:
|
||||
messages.error(request,message)
|
||||
|
||||
else:
|
||||
messages.info(request,"imported Strava workout "+str(stravaid))
|
||||
w = Workout.objects.get(id=id)
|
||||
w.uploadedtostrava=stravaid
|
||||
w.save()
|
||||
|
||||
else:
|
||||
messages.error(request,"Couldn't import Strava workout "+str(stravaid))
|
||||
r = getrower(request.user)
|
||||
res = stravastuff.get_strava_workouts(r)
|
||||
if res == 1:
|
||||
messages.info(request,"Your workouts are being imported and should appear on the site in the next 15 minutes")
|
||||
else:
|
||||
messages.error(request,"Couldn't import Strava workout "+str(stravaid))
|
||||
|
||||
url = reverse(workouts_view)
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
@@ -224,6 +224,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
LOGIN_REDIRECT_URL = '/rowers/list-workouts/'
|
||||
LOGIN_URL = '/login/'
|
||||
LOGOUT_URL = '/logout/'
|
||||
LOGOUT_REDIRECT_URL = '/'
|
||||
|
||||
# Update Cache with task progress password
|
||||
|
||||
|
||||
@@ -59,7 +59,9 @@ urlpatterns += [
|
||||
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||
url(r'^$',rootview),
|
||||
url(r'^login/',auth_views.login, name='login'),
|
||||
url(r'^logout/',auth_views.logout_then_login,name='logout'),
|
||||
url(r'^logout/$',auth_views.logout,
|
||||
{'next_page': '/'},
|
||||
name='logout',),
|
||||
url(r'^rowers/',include('rowers.urls')),
|
||||
url(r'^cvkbrno/',include('cvkbrno.urls')),
|
||||
url(r'^admin/rq/',include('django_rq_dashboard.urls')),
|
||||
|
||||
@@ -144,7 +144,7 @@
|
||||
</div>
|
||||
<div class="grid_1">
|
||||
{% if user.is_authenticated %}
|
||||
<p><a class="button gray small" href="{% url 'logout' %}">logout</a></p>
|
||||
<p><a class="button gray small" href="{% url 'logout' %}?next=/login">logout</a></p>
|
||||
{% else %}
|
||||
<p> </p>
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user