Merge branch 'release/v5.44'
This commit is contained in:
@@ -56,7 +56,7 @@ import sys
|
|||||||
|
|
||||||
import utils
|
import utils
|
||||||
import datautils
|
import datautils
|
||||||
from utils import lbstoN,myqueue
|
from utils import lbstoN,myqueue,is_ranking_piece
|
||||||
|
|
||||||
from timezonefinder import TimezoneFinder
|
from timezonefinder import TimezoneFinder
|
||||||
|
|
||||||
@@ -921,6 +921,9 @@ def save_workout_database(f2, r, dosmooth=True, workouttype='rower',
|
|||||||
w.startdatetime = timezone.now()
|
w.startdatetime = timezone.now()
|
||||||
w.save()
|
w.save()
|
||||||
|
|
||||||
|
if is_ranking_piece(w):
|
||||||
|
w.rankingpiece = True
|
||||||
|
w.save()
|
||||||
|
|
||||||
if privacy == 'visible':
|
if privacy == 'visible':
|
||||||
ts = Team.objects.filter(rower=r)
|
ts = Team.objects.filter(rower=r)
|
||||||
|
|||||||
@@ -493,7 +493,17 @@ def handle_otwsetpower(self,f1, boattype, weightvalue,
|
|||||||
def handle_updateergcp(rower_id,workoutfilenames,debug=False,**kwargs):
|
def handle_updateergcp(rower_id,workoutfilenames,debug=False,**kwargs):
|
||||||
therows = []
|
therows = []
|
||||||
for f1 in workoutfilenames:
|
for f1 in workoutfilenames:
|
||||||
rowdata = rdata(f1)
|
try:
|
||||||
|
rowdata = rdata(f1)
|
||||||
|
except IOError:
|
||||||
|
try:
|
||||||
|
rowdata = rdata(f1 + '.csv')
|
||||||
|
except IOError:
|
||||||
|
try:
|
||||||
|
rowdata = rdata(f1 + '.gz')
|
||||||
|
except IOError:
|
||||||
|
rowdata = 0
|
||||||
|
|
||||||
if rowdata != 0:
|
if rowdata != 0:
|
||||||
therows.append(rowdata)
|
therows.append(rowdata)
|
||||||
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
E408191@CZ27LT9RCGN72.63064:1514927368
|
|
||||||
@@ -4,12 +4,49 @@
|
|||||||
|
|
||||||
{% block title %}Rowsandall Workouts List{% endblock %}
|
{% block title %}Rowsandall Workouts List{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block scripts %}
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
setTimeout("location.reload(true);",60000);
|
setTimeout("location.reload(true);",60000);
|
||||||
</script>
|
</script>
|
||||||
|
<script
|
||||||
|
type='text/javascript'
|
||||||
|
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
|
||||||
|
</script>
|
||||||
|
<script>
|
||||||
|
$(function() {
|
||||||
|
$("td.rankingtoggle").click( function() {
|
||||||
|
var workout_id = $(this).attr('workoutid');
|
||||||
|
console.log(workout_id);
|
||||||
|
$.getJSON(window.location.protocol + '//'+window.location.host + '/rowers/workout/'+workout_id+'/toggle-ranking', function(json) {
|
||||||
|
console.log(JSON.stringify(json));
|
||||||
|
rankingpiece = json.result;
|
||||||
|
tdid = "#star"+workout_id;
|
||||||
|
console.log(rankingpiece);
|
||||||
|
console.log($(tdid).length);
|
||||||
|
if (rankingpiece) {
|
||||||
|
$(tdid).addClass('yellow');
|
||||||
|
$(tdid).removeClass('notyellow');
|
||||||
|
$(tdid).html('★');
|
||||||
|
console.log('adding yellow '+tdid);
|
||||||
|
} else {
|
||||||
|
$(tdid).removeClass('yellow');
|
||||||
|
$(tdid).addClass('notyellow');
|
||||||
|
$(tdid).html('☆');
|
||||||
|
console.log('remove yellow '+tdid);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<style>
|
||||||
|
#mypointer {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<div class="grid_12">
|
<div class="grid_12">
|
||||||
|
|
||||||
@@ -51,6 +88,7 @@
|
|||||||
<table width="100%" class="listtable shortpadded">
|
<table width="100%" class="listtable shortpadded">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
<th> R</th>
|
||||||
<th style="width:80"> Date</th>
|
<th style="width:80"> Date</th>
|
||||||
<th> Time</th>
|
<th> Time</th>
|
||||||
<th> Name</th>
|
<th> Name</th>
|
||||||
@@ -76,155 +114,166 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
<tr>
|
<tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
<td id="mypointer"
|
||||||
|
class="rankingtoggle" workoutid="{{ workout.id }}">
|
||||||
|
{% if workout.rankingpiece %}
|
||||||
|
<span id="star{{ workout.id }}" class="yellow">★</span>
|
||||||
|
{% else %}
|
||||||
|
<span id="star{{ workout.id }}" class="notyellow">☆</span>
|
||||||
|
{% endif %}
|
||||||
|
</td>
|
||||||
<td> {{ workout.date|date:"Y-m-d" }} </td>
|
<td> {{ workout.date|date:"Y-m-d" }} </td>
|
||||||
<td> {{ workout.starttime|date:"H:i" }} </td>
|
<td> {{ workout.starttime|date:"H:i" }} </td>
|
||||||
<td>
|
|
||||||
{% if workout.user.user == user or user == team.manager %}
|
{% if workout.user.user == user or user == team.manager %}
|
||||||
{% if workout.rankingpiece %}
|
|
||||||
[RANKING PIECE]
|
|
||||||
{% endif %}
|
|
||||||
{% if workout.name != '' %}
|
{% if workout.name != '' %}
|
||||||
<a href={% url rower.defaultlandingpage id=workout.id %}>{{ workout.name }}</a> </td>
|
<td>
|
||||||
{% else %}
|
<a href={% url rower.defaultlandingpage id=workout.id %}>
|
||||||
<a href={% url rower.defaultlandingpage id=workout.id %}>No Name</a> </td>
|
{{ workout.name }}
|
||||||
{% endif %}
|
</a>
|
||||||
{% else %}
|
</td>
|
||||||
{% if workout.name != '' %}
|
{% else %}
|
||||||
<a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a> </td>
|
<td>
|
||||||
{% else %}
|
<a href={% url rower.defaultlandingpage
|
||||||
<a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
id=workout.id %}>No Name
|
||||||
{% endif %}
|
</a></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td> {{ workout.workouttype }} </td>
|
{% else %}
|
||||||
<td> {{ workout.distance }}m</td>
|
{% if workout.name != '' %}
|
||||||
<td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>
|
<td><a href="/rowers/workout/{{ workout.id }}/">{{ workout.name }}</a></td>
|
||||||
<td> {{ workout.averagehr }} </td>
|
{% else %}
|
||||||
<td> {{ workout.maxhr }} </td>
|
<td><a href="/rowers/workout/{{ workout.id }}/">No Name</a> </td>
|
||||||
{% if not team %}
|
{% endif %}
|
||||||
<td>
|
{% endif %}
|
||||||
<a class="small" href="/rowers/workout/{{ workout.id }}/export">Export</a>
|
<td> {{ workout.workouttype }} </td>
|
||||||
</td>
|
<td> {{ workout.distance }}m</td>
|
||||||
|
<td> {{ workout.duration |durationprint:"%H:%M:%S.%f" }} </td>
|
||||||
|
<td> {{ workout.averagehr }} </td>
|
||||||
|
<td> {{ workout.maxhr }} </td>
|
||||||
|
{% if not team %}
|
||||||
|
<td>
|
||||||
|
<a class="small" href="/rowers/workout/{{ workout.id }}/export">Export</a>
|
||||||
|
</td>
|
||||||
|
{% else %}
|
||||||
|
<td colspan="2">
|
||||||
|
{{ workout.user.user.first_name }} {{ workout.user.user.last_name }}
|
||||||
|
</td>
|
||||||
|
{% endif %}
|
||||||
|
<td> <a class="small" href="/rowers/workout/{{ workout.id }}/flexchart">Flex</a> </td>
|
||||||
|
<td>
|
||||||
|
<a class="small" href="/rowers/workout/{{ workout.id }}/deleteconfirm">Delete
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<td colspan="2">
|
<p> No workouts found </p>
|
||||||
{{ workout.user.user.first_name }} {{ workout.user.user.last_name }}
|
|
||||||
</td>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<td> <a class="small" href="/rowers/workout/{{ workout.id }}/flexchart">Flex</a> </td>
|
|
||||||
<td>
|
|
||||||
<a class="small" href="/rowers/workout/{{ workout.id }}/deleteconfirm">Delete
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
</tbody>
|
|
||||||
</table>
|
|
||||||
{% else %}
|
|
||||||
<p> No workouts found </p>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="grid_4 omega">
|
|
||||||
{% if team %}
|
|
||||||
<div class="grid_4" id="teambuttons">
|
|
||||||
<div class="grid_3 alpha">
|
|
||||||
<p>
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
|
||||||
<div class="grid_4" id="interactiveplot">
|
|
||||||
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
<div class="grid_4 omega">
|
||||||
<script async="true" type="text/javascript">
|
{% if team %}
|
||||||
Bokeh.set_log_level("info");
|
<div class="grid_4" id="teambuttons">
|
||||||
</script>
|
<div class="grid_3 alpha">
|
||||||
|
<p>
|
||||||
{{ interactiveplot |safe }}
|
|
||||||
|
</p>
|
||||||
<script>
|
|
||||||
// Set things up to resize the plot on a window resize. You can play with
|
|
||||||
// the arguments of resize_width_height() to change the plot's behavior.
|
|
||||||
var plot_resize_setup = function () {
|
|
||||||
var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot
|
|
||||||
var plot = Bokeh.index[plotid];
|
|
||||||
var plotresizer = function() {
|
|
||||||
// arguments: use width, use height, maintain aspect ratio
|
|
||||||
plot.resize_width_height(true, true, true);
|
|
||||||
};
|
|
||||||
window.addEventListener('resize', plotresizer);
|
|
||||||
plotresizer();
|
|
||||||
};
|
|
||||||
window.addEventListener('load', plot_resize_setup);
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
|
||||||
html, body {height: 100%; margin:5px;}
|
|
||||||
</style>
|
|
||||||
{{ the_div |safe }}
|
|
||||||
</div>
|
|
||||||
<div class="grid_4" id="announcements">
|
|
||||||
{% if announcements %}
|
|
||||||
<h3>What's New?</h3>
|
|
||||||
{% for a in announcements %}
|
|
||||||
<div class="site-announcement-box">
|
|
||||||
<div class="site-announcement">
|
|
||||||
<i>{{ a.created }}:</i>
|
|
||||||
{{ a.announcement|urlize }}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
|
||||||
<p> </p>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
<div class="grid_4" id="interactiveplot">
|
||||||
<div class="grid_4" id="about">
|
<script type="text/javascript" src="/static/js/bokeh-0.12.3.min.js"></script>
|
||||||
<h3>About</h3>
|
<script async="true" type="text/javascript">
|
||||||
<p>This site is a beta site, pioneering rowing data visualization and analysis. No warranties. The site's author is
|
Bokeh.set_log_level("info");
|
||||||
Sander Roosendaal. A Masters rower.
|
</script>
|
||||||
|
|
||||||
Read his <a href="http://blog.rowsandall.com/">blog</a>
|
{{ interactiveplot |safe }}
|
||||||
</p>
|
|
||||||
<div style="text-align: right; padding: 2em">
|
<script>
|
||||||
<a href="http://blog.rowsandall.com/">
|
// Set things up to resize the plot on a window resize. You can play with
|
||||||
<img src="/static/img/sander.jpg" width="80"></a>
|
// the arguments of resize_width_height() to change the plot's behavior.
|
||||||
|
var plot_resize_setup = function () {
|
||||||
|
var plotid = Object.keys(Bokeh.index)[0]; // assume we have just one plot
|
||||||
|
var plot = Bokeh.index[plotid];
|
||||||
|
var plotresizer = function() {
|
||||||
|
// arguments: use width, use height, maintain aspect ratio
|
||||||
|
plot.resize_width_height(true, true, true);
|
||||||
|
};
|
||||||
|
window.addEventListener('resize', plotresizer);
|
||||||
|
plotresizer();
|
||||||
|
};
|
||||||
|
window.addEventListener('load', plot_resize_setup);
|
||||||
|
</script>
|
||||||
|
<style>
|
||||||
|
/* Need this to get the page in "desktop mode"; not having an infinite height.*/
|
||||||
|
html, body {height: 100%; margin:5px;}
|
||||||
|
</style>
|
||||||
|
{{ the_div |safe }}
|
||||||
|
</div>
|
||||||
|
<div class="grid_4" id="announcements">
|
||||||
|
{% if announcements %}
|
||||||
|
<h3>What's New?</h3>
|
||||||
|
{% for a in announcements %}
|
||||||
|
<div class="site-announcement-box">
|
||||||
|
<div class="site-announcement">
|
||||||
|
<i>{{ a.created }}:</i>
|
||||||
|
{{ a.announcement|urlize }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
<p> </p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="grid_4" id="about">
|
||||||
|
<h3>About</h3>
|
||||||
|
<p>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 <a href="http://blog.rowsandall.com/">blog</a>
|
||||||
|
</p>
|
||||||
|
<div style="text-align: right; padding: 2em">
|
||||||
|
<a href="http://blog.rowsandall.com/">
|
||||||
|
<img src="/static/img/sander.jpg" width="80"></a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
|
|
||||||
<div class="grid_6 alpha">
|
<div class="grid_6 alpha">
|
||||||
{% if rankingonly and not team %}
|
{% if rankingonly and not team %}
|
||||||
<div class="grid_2 prefix_1 alpha">
|
<div class="grid_2 prefix_1 alpha">
|
||||||
<a class="button small green" href="/rowers/list-workouts">All Workouts</a>
|
<a class="button small green" href="/rowers/list-workouts">All Workouts</a>
|
||||||
</div>
|
</div>
|
||||||
{% elif not team %}
|
{% elif not team %}
|
||||||
<div class="grid_2 prefix_1 alpha">
|
<div class="grid_2 prefix_1 alpha">
|
||||||
<a class="button small green" href="/rowers/list-workouts/ranking">Ranking Pieces Only</a>
|
<a class="button small green" href="/rowers/list-workouts/ranking">Ranking Pieces Only</a>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="grid_2 suffix_1 omega">
|
<div class="grid_2 suffix_1 omega">
|
||||||
<a class="button small gray" href="/rowers/workouts-join-select">Glue Workouts</a>
|
<a class="button small gray" href="/rowers/workouts-join-select">Glue Workouts</a>
|
||||||
</div>
|
</div>
|
||||||
<p> </p>
|
<p> </p>
|
||||||
{% if team %}
|
{% if team %}
|
||||||
<form id="searchform" action="/rowers/list-workouts/team/{{ team.id }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
|
<form id="searchform" action="/rowers/list-workouts/team/{{ team.id }}/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
|
||||||
method="get" accept-charset="utf-8">
|
method="get" accept-charset="utf-8">
|
||||||
{% else %}
|
{% else %}
|
||||||
<form id="searchform" action="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
|
<form id="searchform" action="/rowers/list-workouts/{{ startdate|date:"Y-m-d" }}/{{ enddate|date:"Y-m-d" }}"
|
||||||
method="get" accept-charset="utf-8">
|
method="get" accept-charset="utf-8">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<div class="grid_3 prefix_1 alpha">
|
<div class="grid_3 prefix_1 alpha">
|
||||||
<input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search">
|
<input class="searchfield" id="searchbox" name="q" type="text" placeholder="Search">
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_1 omega">
|
<div class="grid_1 omega">
|
||||||
<button class="button blue small" type="submit">
|
<button class="button blue small" type="submit">
|
||||||
Search
|
Search
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="grid_2 omega">
|
<div class="grid_2 omega">
|
||||||
<span class="button gray small">
|
<span class="button gray small">
|
||||||
@@ -248,5 +297,5 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -212,6 +212,7 @@ urlpatterns = [
|
|||||||
url(r'^graph/(?P<id>\d+)/deleteconfirm$',views.graph_delete_confirm_view),
|
url(r'^graph/(?P<id>\d+)/deleteconfirm$',views.graph_delete_confirm_view),
|
||||||
url(r'^graph/(?P<id>\d+)/delete$',views.graph_delete_view),
|
url(r'^graph/(?P<id>\d+)/delete$',views.graph_delete_view),
|
||||||
url(r'^workout/(?P<id>\d+)/get-thumbnails$',views.get_thumbnails),
|
url(r'^workout/(?P<id>\d+)/get-thumbnails$',views.get_thumbnails),
|
||||||
|
url(r'^workout/(?P<id>\d+)/toggle-ranking$',views.workout_toggle_ranking),
|
||||||
url(r'^workout/(?P<id>\d+)/get-testscript$',views.get_testscript),
|
url(r'^workout/(?P<id>\d+)/get-testscript$',views.get_testscript),
|
||||||
url(r'^workout/upload/team/$',views.team_workout_upload_view),
|
url(r'^workout/upload/team/$',views.team_workout_upload_view),
|
||||||
url(r'^workout/upload/$',views.workout_upload_view,name='workout_upload_view'),
|
url(r'^workout/upload/$',views.workout_upload_view,name='workout_upload_view'),
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import colorsys
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
|
||||||
import uuid
|
import uuid
|
||||||
|
import datetime
|
||||||
|
|
||||||
lbstoN = 4.44822
|
lbstoN = 4.44822
|
||||||
|
|
||||||
@@ -127,6 +128,22 @@ palettes = {
|
|||||||
'yellow_red':trcolors(255,255,178,189,0,39)
|
'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'):
|
def range_to_color_hex(groupcols,palette='monochrome_blue'):
|
||||||
|
|
||||||
|
|||||||
107
rowers/views.py
107
rowers/views.py
@@ -711,7 +711,8 @@ def splitstdata(lijst):
|
|||||||
from utils import (
|
from utils import (
|
||||||
geo_distance,serialize_list,deserialize_list,uniqify,
|
geo_distance,serialize_list,deserialize_list,uniqify,
|
||||||
str2bool,range_to_color_hex,absolute,myqueue,get_call,
|
str2bool,range_to_color_hex,absolute,myqueue,get_call,
|
||||||
calculate_age
|
calculate_age,rankingdistances,rankingdurations,
|
||||||
|
is_ranking_piece
|
||||||
)
|
)
|
||||||
|
|
||||||
import datautils
|
import datautils
|
||||||
@@ -3175,7 +3176,7 @@ def addmanual_view(request):
|
|||||||
|
|
||||||
if id:
|
if id:
|
||||||
w = Workout.objects.get(id=id)
|
w = Workout.objects.get(id=id)
|
||||||
w.rankingpiece = rankingpiece
|
w.rankingpiece = rankingpiece or is_ranking_piece(w)
|
||||||
w.notes = notes
|
w.notes = notes
|
||||||
w.save()
|
w.save()
|
||||||
messages.info(request,'New workout created')
|
messages.info(request,'New workout created')
|
||||||
@@ -3297,29 +3298,22 @@ def rankings_view(request,theuser=0,
|
|||||||
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||||
enddate = enddate+datetime.timedelta(days=1)
|
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 = []
|
thedistances = []
|
||||||
theworkouts = []
|
theworkouts = []
|
||||||
thesecs = []
|
thesecs = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
rankingdistances.sort()
|
rankingdistances.sort()
|
||||||
rankingdurations.sort()
|
rankingdurations.sort()
|
||||||
|
|
||||||
for rankingdistance in rankingdistances:
|
for rankingdistance in rankingdistances:
|
||||||
|
|
||||||
workouts = Workout.objects.filter(user=r,distance=rankingdistance,
|
workouts = Workout.objects.filter(
|
||||||
workouttype__in=['rower','dynamic','slides'],
|
user=r,distance=rankingdistance,
|
||||||
startdatetime__gte=startdate,
|
workouttype__in=['rower','dynamic','slides'],
|
||||||
startdatetime__lte=enddate).order_by('duration')
|
rankingpiece=True,
|
||||||
|
startdatetime__gte=startdate,
|
||||||
|
startdatetime__lte=enddate
|
||||||
|
).order_by('duration')
|
||||||
if workouts:
|
if workouts:
|
||||||
thedistances.append(rankingdistance)
|
thedistances.append(rankingdistance)
|
||||||
theworkouts.append(workouts[0])
|
theworkouts.append(workouts[0])
|
||||||
@@ -3333,10 +3327,13 @@ def rankings_view(request,theuser=0,
|
|||||||
|
|
||||||
for rankingduration in rankingdurations:
|
for rankingduration in rankingdurations:
|
||||||
|
|
||||||
workouts = Workout.objects.filter(user=r,duration=rankingduration,
|
workouts = Workout.objects.filter(
|
||||||
workouttype='rower',
|
user=r,duration=rankingduration,
|
||||||
startdatetime__gte=startdate,
|
workouttype='rower',
|
||||||
startdatetime__lte=enddate).order_by('-distance')
|
rankingpiece=True,
|
||||||
|
startdatetime__gte=startdate,
|
||||||
|
startdatetime__lte=enddate
|
||||||
|
).order_by('-distance')
|
||||||
if workouts:
|
if workouts:
|
||||||
thedistances.append(workouts[0].distance)
|
thedistances.append(workouts[0].distance)
|
||||||
theworkouts.append(workouts[0])
|
theworkouts.append(workouts[0])
|
||||||
@@ -3641,13 +3638,6 @@ def rankings_view2(request,theuser=0,
|
|||||||
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
enddate = datetime.datetime.combine(enddate,datetime.time(23,59,59))
|
||||||
enddate = enddate+datetime.timedelta(days=1)
|
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 = []
|
thedistances = []
|
||||||
theworkouts = []
|
theworkouts = []
|
||||||
@@ -3660,10 +3650,12 @@ def rankings_view2(request,theuser=0,
|
|||||||
|
|
||||||
for rankingdistance in rankingdistances:
|
for rankingdistance in rankingdistances:
|
||||||
|
|
||||||
workouts = Workout.objects.filter(user=r,distance=rankingdistance,
|
workouts = Workout.objects.filter(
|
||||||
workouttype__in=['rower','dynamic','slides'],
|
user=r,distance=rankingdistance,
|
||||||
startdatetime__gte=startdate,
|
workouttype__in=['rower','dynamic','slides'],
|
||||||
startdatetime__lte=enddate).order_by('duration')
|
rankingpiece=True,
|
||||||
|
startdatetime__gte=startdate,
|
||||||
|
startdatetime__lte=enddate).order_by('duration')
|
||||||
if workouts:
|
if workouts:
|
||||||
thedistances.append(rankingdistance)
|
thedistances.append(rankingdistance)
|
||||||
theworkouts.append(workouts[0])
|
theworkouts.append(workouts[0])
|
||||||
@@ -3677,10 +3669,12 @@ def rankings_view2(request,theuser=0,
|
|||||||
|
|
||||||
for rankingduration in rankingdurations:
|
for rankingduration in rankingdurations:
|
||||||
|
|
||||||
workouts = Workout.objects.filter(user=r,duration=rankingduration,
|
workouts = Workout.objects.filter(
|
||||||
workouttype='rower',
|
user=r,duration=rankingduration,
|
||||||
startdatetime__gte=startdate,
|
workouttype='rower',
|
||||||
startdatetime__lte=enddate).order_by('-distance')
|
rankingpiece=True,
|
||||||
|
startdatetime__gte=startdate,
|
||||||
|
startdatetime__lte=enddate).order_by('-distance')
|
||||||
if workouts:
|
if workouts:
|
||||||
thedistances.append(workouts[0].distance)
|
thedistances.append(workouts[0].distance)
|
||||||
theworkouts.append(workouts[0])
|
theworkouts.append(workouts[0])
|
||||||
@@ -3983,12 +3977,6 @@ def otwrankings_view(request,theuser=0,
|
|||||||
enddate = enddate+datetime.timedelta(days=1)
|
enddate = enddate+datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
|
||||||
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))
|
|
||||||
rankingdurations.append(datetime.time(hour=1,minute=15))
|
|
||||||
|
|
||||||
thedistances = []
|
thedistances = []
|
||||||
theworkouts = []
|
theworkouts = []
|
||||||
@@ -4235,14 +4223,6 @@ def oterankings_view(request,theuser=0,
|
|||||||
enddate = enddate+datetime.timedelta(days=1)
|
enddate = enddate+datetime.timedelta(days=1)
|
||||||
|
|
||||||
|
|
||||||
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))
|
|
||||||
rankingdurations.append(datetime.time(hour=1,minute=15))
|
|
||||||
|
|
||||||
rankingdistances = [100,500,1000,2000,5000,6000,10000,21097,42195,100000]
|
|
||||||
|
|
||||||
thedistances = []
|
thedistances = []
|
||||||
theworkouts = []
|
theworkouts = []
|
||||||
@@ -9302,6 +9282,35 @@ def workout_getc2workout_view(request,c2id):
|
|||||||
url = reverse(workout_c2import_view)
|
url = reverse(workout_c2import_view)
|
||||||
return HttpResponseRedirect(url)
|
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
|
# This is the main view for processing uploaded files
|
||||||
@login_required()
|
@login_required()
|
||||||
def workout_upload_view(request,
|
def workout_upload_view(request,
|
||||||
|
|||||||
@@ -56,6 +56,19 @@ body {
|
|||||||
padding-bottom: 20px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.notyellow {
|
||||||
|
font-size: 1.2em;
|
||||||
|
height: auto;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.yellow {
|
||||||
|
color: #cccc00;
|
||||||
|
font-size: 1.2em;
|
||||||
|
height: auto;
|
||||||
|
padding: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
a {
|
a {
|
||||||
/* color: #fff; */
|
/* color: #fff; */
|
||||||
|
|||||||
Reference in New Issue
Block a user