Private
Public Access
1
0
This commit is contained in:
Sander Roosendaal
2022-02-16 11:13:14 +01:00
parent 2fb011e876
commit 4f48901c55
7 changed files with 76 additions and 160 deletions

View File

@@ -32,7 +32,6 @@ from rq.registry import StartedJobRegistry
from rq.exceptions import NoSuchJobError
import threading
import redis
import time
import colorsys
import zipfile
@@ -143,7 +142,6 @@ from rowers.models import (
PlannedSession, DeactivateUserForm, DeleteUserForm,
TrainingPlan, TrainingPlanForm, TrainingTarget, TrainingTargetForm,
TrainingMacroCycle, TrainingMesoCycle, TrainingMicroCycle,
TrainingTarget, TrainingTargetForm,
TrainingMacroCycleForm, createmacrofillers,
createmicrofillers, createmesofillers,
microcyclecheckdates, mesocyclecheckdates, macrocyclecheckdates,
@@ -221,7 +219,6 @@ from rowsandall_app.settings import (
NK_REDIRECT_URI, NK_CLIENT_ID, NK_CLIENT_SECRET
)
#from rowers.tasks_standalone import addcomment2
from django.contrib import messages
from async_messages import messages as a_messages
@@ -261,7 +258,7 @@ from rowers.tasks import (
)
from scipy.signal import savgol_filter
#from django.shortcuts import render_to_response
try:
from Cookie import SimpleCookie
except ModuleNotFoundError:
@@ -505,7 +502,7 @@ def getrequestrower(request, rowerid=0, userid=0, notpermanent=False):
# if userid == 0:
# userid = request.user.id
if notpermanent == False:
if notpermanent is False:
if rowerid == 0 and 'rowerid' in request.session:
rowerid = request.session['rowerid']
@@ -537,7 +534,7 @@ def getrequestrower(request, rowerid=0, userid=0, notpermanent=False):
request.session['rowerid'] = request.user.rower.id
raise PermissionDenied("You have no access to this user")
if notpermanent == False:
if notpermanent is False:
request.session['rowerid'] = r.id
request.session['rowerid'] = r.id
@@ -551,7 +548,7 @@ def getrequestrowercoachee(request, rowerid=0, userid=0, notpermanent=False):
# if userid == 0:
# userid = request.user.id
if notpermanent == False:
if notpermanent is False:
if rowerid == 0 and 'rowerid' in request.session:
rowerid = request.session['rowerid']
@@ -583,7 +580,7 @@ def getrequestrowercoachee(request, rowerid=0, userid=0, notpermanent=False):
request.session['rowerid'] = request.user.rower.id
raise PermissionDenied("You have no access to this user")
if notpermanent == False:
if notpermanent is False:
request.session['rowerid'] = r.id
request.session['rowerid'] = r.id
@@ -595,7 +592,7 @@ def getrequestplanrower(request, rowerid=0, userid=0, notpermanent=False):
userid = int(userid)
rowerid = int(rowerid)
if notpermanent == False:
if notpermanent is False:
if rowerid == 0 and 'rowerid' in request.session:
rowerid = request.session['rowerid']
@@ -625,7 +622,7 @@ def getrequestplanrower(request, rowerid=0, userid=0, notpermanent=False):
request.session['rowerid'] = r.id
raise PermissionDenied("You have no access to this user")
if notpermanent == False:
if notpermanent is False:
request.session['rowerid'] = r.id
return r
@@ -671,7 +668,6 @@ def get_workoutuser(id, request):
def getvalue(data): # pragma: no cover
perc = 0
total = 1
done = 0
id = 0
@@ -738,12 +734,11 @@ except ImportError: # pragma: no cover
pass
try:
from rest_framework import status, permissions, generics
from rest_framework import permissions, generics
except ImportError: # pragma: no cover
pass
#LOCALTIMEZONE = tz('Etc/UTC')
USER_LANGUAGE = 'en-US'
@@ -1043,16 +1038,6 @@ def get_thumbnails(request, id):
row = get_workout_by_opaqueid(request, id)
r = getrower(request.user)
result = request.user.is_authenticated and ispromember(request.user)
if result:
promember = 1
if request.user == row.user.user:
mayedit = 1
comments = WorkoutComment.objects.filter(workout=row)
aantalcomments = len(comments)
favorites, maxfav = getfavorites(r, row)
charts = []
@@ -1143,8 +1128,7 @@ def session_jobs_status(request):
def rowhascoordinates(row):
# create interactive plot
f1 = row.csvfilename
u = row.user.user
r = getrower(u)
rowdata = rdata(csvfile=f1)
hascoordinates = 1
if rowdata != 0:
@@ -1191,11 +1175,11 @@ def get_my_teams(user):
teams1 = []
teams2 = Team.objects.filter(manager=user)
teams = list(set(teams1).union(set(teams2)))
myteams = list(set(teams1).union(set(teams2)))
except TypeError:
teams = []
myteams = []
return teams
return myteams
# Used for the interval editor - translates seconds to a time object