-
-
-
- {{ interactiveplot |safe }}
-
-
-
- {{ the_div |safe }}
-
- {% if announcements %}
-
What's New?
- {% for a in announcements %}
-
-
-
{{ a.created }}:
- {{ a.announcement|urlize }}
+
+
+
+ {% if team %}
+
- {% endfor %}
-
{% endif %}
-
-
-
About
-
This site is a beta site, pioneering rowing data visualization and analysis. No warranties. The site's author is
- Sander Roosendaal. A Masters rower.
+
+
+
- Read his
blog
-
-
-
- 
+ {{ interactiveplot |safe }}
+
+
+
+ {{ the_div |safe }}
+
+
+ {% if announcements %}
+
What's New?
+ {% for a in announcements %}
+
+
+ {{ a.created }}:
+ {{ a.announcement|urlize }}
+
+
+ {% endfor %}
+
+ {% endif %}
+
+
+
About
+
This site is a beta site, pioneering rowing data visualization and analysis. No warranties. The site's author is
+ Sander Roosendaal. A Masters rower.
+
+ Read his blog
+
+
+
+ 
+
-
{% if rankingonly and not team %}
-
- {% elif not team %}
-
- {% endif %}
-
-
+
+ {% elif not team %}
+
+ {% endif %}
+
+
{% if team %}
+
@@ -248,5 +297,5 @@
{% endif %}
{% endif %}
-
-{% endblock %}
+
+ {% endblock %}
diff --git a/rowers/urls.py b/rowers/urls.py
index 59e86aa2..7c5b3679 100644
--- a/rowers/urls.py
+++ b/rowers/urls.py
@@ -212,6 +212,7 @@ urlpatterns = [
url(r'^graph/(?P\d+)/deleteconfirm$',views.graph_delete_confirm_view),
url(r'^graph/(?P\d+)/delete$',views.graph_delete_view),
url(r'^workout/(?P\d+)/get-thumbnails$',views.get_thumbnails),
+ url(r'^workout/(?P\d+)/toggle-ranking$',views.workout_toggle_ranking),
url(r'^workout/(?P\d+)/get-testscript$',views.get_testscript),
url(r'^workout/upload/team/$',views.team_workout_upload_view),
url(r'^workout/upload/$',views.workout_upload_view,name='workout_upload_view'),
diff --git a/rowers/utils.py b/rowers/utils.py
index 5b87053a..26f74d3d 100644
--- a/rowers/utils.py
+++ b/rowers/utils.py
@@ -5,6 +5,7 @@ import colorsys
from django.conf import settings
import uuid
+import datetime
lbstoN = 4.44822
@@ -127,6 +128,22 @@ palettes = {
'yellow_red':trcolors(255,255,178,189,0,39)
}
+rankingdistances = [100,500,1000,2000,5000,6000,10000,21097,42195,100000]
+rankingdurations = []
+rankingdurations.append(datetime.time(minute=1))
+rankingdurations.append(datetime.time(minute=4))
+rankingdurations.append(datetime.time(minute=30))
+rankingdurations.append(datetime.time(hour=1,minute=15))
+rankingdurations.append(datetime.time(hour=1))
+
+
+def is_ranking_piece(workout):
+ if workout.distance in rankingdistances:
+ return True
+ elif workout.duration in rankingdurations:
+ return True
+
+ return False
def range_to_color_hex(groupcols,palette='monochrome_blue'):
diff --git a/rowers/views.py b/rowers/views.py
index a19d7eeb..65b9bdcf 100644
--- a/rowers/views.py
+++ b/rowers/views.py
@@ -711,7 +711,7 @@ def splitstdata(lijst):
from utils import (
geo_distance,serialize_list,deserialize_list,uniqify,
str2bool,range_to_color_hex,absolute,myqueue,get_call,
- calculate_age
+ calculate_age,rankingdistances,rankingdurations
)
import datautils
@@ -3297,20 +3297,10 @@ def rankings_view(request,theuser=0,
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
enddate = enddate+datetime.timedelta(days=1)
- rankingdistances = [100,500,1000,2000,5000,6000,10000,21097,42195,100000]
- rankingdurations = []
- rankingdurations.append(datetime.time(minute=1))
- rankingdurations.append(datetime.time(minute=4))
- rankingdurations.append(datetime.time(minute=30))
- rankingdurations.append(datetime.time(hour=1,minute=15))
- rankingdurations.append(datetime.time(hour=1))
-
thedistances = []
theworkouts = []
thesecs = []
-
-
rankingdistances.sort()
rankingdurations.sort()
@@ -9302,6 +9292,35 @@ def workout_getc2workout_view(request,c2id):
url = reverse(workout_c2import_view)
return HttpResponseRedirect(url)
+@login_required
+def workout_toggle_ranking(request,id=0):
+ is_ajax = False
+ if request.is_ajax():
+ is_ajax = True
+
+ try:
+ # check if valid ID exists (workout exists)
+ row = Workout.objects.get(id=id)
+ except Workout.DoesNotExist:
+ raise Http404("Workout doesn't exist")
+
+ if not checkworkoutuser(request.user,row):
+ message = "You are not allowed to change this workout"
+ messages.error(request,message)
+
+ # we are still here - we own the workout
+ row.rankingpiece = not row.rankingpiece
+ row.save()
+
+ if is_ajax:
+ return JSONResponse({'result':row.rankingpiece})
+ else:
+ url = reverse(workouts_view)
+ response = HttpResponseRedirect(url)
+
+ return response
+
+
# This is the main view for processing uploaded files
@login_required()
def workout_upload_view(request,
diff --git a/static/css/rowsandall.css b/static/css/rowsandall.css
index 0362df15..8b649642 100644
--- a/static/css/rowsandall.css
+++ b/static/css/rowsandall.css
@@ -56,6 +56,19 @@ body {
padding-bottom: 20px;
}
+.notyellow {
+ font-size: 1.2em;
+ height: auto;
+ padding: 0px;
+}
+
+.yellow {
+ color: #cccc00;
+ font-size: 1.2em;
+ height: auto;
+ padding: 0px;
+}
+
a {
/* color: #fff; */