Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2022-09-14 22:06:09 +02:00
parent 088d56eaed
commit bcb953132e
2 changed files with 13 additions and 12 deletions

View File

@@ -24,14 +24,14 @@
title="Delete">
<i class="fas fa-trash-alt fa-fw"></i>
</a>
<a class="small iteratorleft"
<a class="small iteratorleft"
data-nperiod="{{ stats|alertnperiod:forloop.counter }}"
data-user="{{ rower.user.id }}"
data-alertid="{{ alert.id }}"
href="/rowers/alerts/{{ alert.id }}/report/">
<i class="fas fa-arrow-alt-left fa-fw"></i>
</a>
<a class="small iteratorright"
<a class="small iteratorright"
data-nperiod="{{ stats|alertnperiod:forloop.counter }}"
data-user="{{ rower.user.id }}"
data-alertid="{{ alert.id }}"
@@ -39,7 +39,7 @@
<i class="fas fa-arrow-alt-right fa-fw"></i>
</a>
<hr>
<a id="percentages" href="/rowers/alerts/{{ alert.id }}/report/">
<a id="percentages" href="/rowers/alerts/{{ alert.id }}/report/">
<div>
<h1><span id="percentage">{{ stats|alertstatspercentage:forloop.counter }}</span>%</h1>
</div>
@@ -89,6 +89,7 @@
var alertid = $(this).data().alertid;
var thediv = $(this);
url = "/rowers/alerts/"+alertid+"/report/"+nperiod+"/user/"+user+"/";
console.log(url);
$.getJSON(window.location.protocol + '//' + window.location.host + url,
function(json) {
var percentage = json['stats']['percentage'];
@@ -109,11 +110,11 @@
if ( nperiod<0 ) {
nperiod=0
};
var user = $(this).data().user;
var alertid = $(this).data().alertid;
var thediv = $(this)
url = "/rowers/alerts/"+alertid+"/report/"+nperiod+"/user/"+user+"/";
url = "/rowers/alerts/"+alertid+"/report/"+nperiod+"/user/"+user+"/";
$.getJSON(window.location.protocol + '//' + window.location.host + url,
function(json) {
var percentage = json['stats']['percentage'];
@@ -128,7 +129,7 @@
});
});
});
});
</script>
{% endblock %}

View File

@@ -646,12 +646,12 @@ def workout_nkimport_view(request, userid=0, after=0, before=0):
startdate = startdate.date()
enddate = enddate.date()
r = getrequestrower(request, userid=userid)
if r.user != request.user: # pragma: no cover
messages.error(
request, 'You can only access your own workouts on the NK Logbook, not those of your athletes')
url = reverse('workout_nkimport_view', kwargs={
'userid': request.user.id})
return HttpResponseRedirect(url)
#if r.user != request.user: # pragma: no cover
# messages.error(
# request, 'You can only access your own workouts on the NK Logbook, not those of your athletes')
# url = reverse('workout_nkimport_view', kwargs={
# 'userid': request.user.id})
# return HttpResponseRedirect(url)
try:
_ = nk_open(request.user)