cannot pickle list of teams ->
This commit is contained in:
@@ -416,19 +416,6 @@ def handle_sendemail_invite_accept(email,name,teamname,managername):
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
@app.task
|
|
||||||
def handle_remove_workouts_team(ws,t):
|
|
||||||
for w in ws:
|
|
||||||
w.team.remove(t)
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
@app.task
|
|
||||||
def handle_add_workouts_team(ws,t):
|
|
||||||
for w in ws:
|
|
||||||
w.team.add(t)
|
|
||||||
|
|
||||||
return 1
|
|
||||||
|
|
||||||
# Another simple task for debugging purposes
|
# Another simple task for debugging purposes
|
||||||
def add2(x,y):
|
def add2(x,y):
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ from rowers.models import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from rowers.tasks import (
|
from rowers.tasks import (
|
||||||
handle_remove_workouts_team,handle_sendemail_invite,
|
handle_sendemail_invite,
|
||||||
handle_add_workouts_team,handle_sendemail_request,
|
handle_sendemail_request,
|
||||||
handle_sendemail_member_dropped,handle_sendemail_request_accept,
|
handle_sendemail_member_dropped,handle_sendemail_request_accept,
|
||||||
handle_sendemail_request_reject,handle_sendemail_invite_reject,
|
handle_sendemail_request_reject,handle_sendemail_invite_reject,
|
||||||
handle_sendemail_invite_accept,handle_sendemail_team_removed,
|
handle_sendemail_invite_accept,handle_sendemail_team_removed,
|
||||||
@@ -30,6 +30,19 @@ from rowers.tasks import (
|
|||||||
|
|
||||||
inviteduration = 14 # days
|
inviteduration = 14 # days
|
||||||
|
|
||||||
|
def handle_remove_workouts_team(ws,t):
|
||||||
|
for w in ws:
|
||||||
|
w.team.remove(t)
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
|
def handle_add_workouts_team(ws,t):
|
||||||
|
|
||||||
|
for w in ws:
|
||||||
|
w.team.add(t)
|
||||||
|
|
||||||
|
return 1
|
||||||
|
|
||||||
def update_team(t,name,manager,private,notes):
|
def update_team(t,name,manager,private,notes):
|
||||||
if t.manager != manager:
|
if t.manager != manager:
|
||||||
return (0,'You are not the manager of this team')
|
return (0,'You are not the manager of this team')
|
||||||
@@ -81,11 +94,7 @@ def add_member(id,rower):
|
|||||||
# code to add all workouts
|
# code to add all workouts
|
||||||
ws = Workout.objects.filter(user=rower)
|
ws = Workout.objects.filter(user=rower)
|
||||||
|
|
||||||
if settings.DEBUG:
|
|
||||||
res = handle_add_workouts_team(ws,t)
|
res = handle_add_workouts_team(ws,t)
|
||||||
else:
|
|
||||||
res = queuehigh.enqueue(handle_add_workouts_team,ws,t)
|
|
||||||
|
|
||||||
|
|
||||||
set_teamplanexpires(rower)
|
set_teamplanexpires(rower)
|
||||||
|
|
||||||
@@ -97,10 +106,7 @@ def remove_member(id,rower):
|
|||||||
# remove the team from rower's workouts:
|
# remove the team from rower's workouts:
|
||||||
ws = Workout.objects.filter(user=rower,team=t)
|
ws = Workout.objects.filter(user=rower,team=t)
|
||||||
|
|
||||||
if settings.DEBUG:
|
|
||||||
res = handle_remove_workouts_team(ws,t)
|
res = handle_remove_workouts_team(ws,t)
|
||||||
else:
|
|
||||||
res = queuehigh.enqueue(handle_remove_workouts_team,ws,t)
|
|
||||||
|
|
||||||
set_teamplanexpires(rower)
|
set_teamplanexpires(rower)
|
||||||
return (id,'Member removed')
|
return (id,'Member removed')
|
||||||
|
|||||||
@@ -2998,10 +2998,12 @@ def workout_flexchart3_view(request,*args,**kwargs):
|
|||||||
workouttype = 'ote'
|
workouttype = 'ote'
|
||||||
if row.workouttype == 'water':
|
if row.workouttype == 'water':
|
||||||
workouttype = 'otw'
|
workouttype = 'otw'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
favorites = FavoriteChart.objects.filter(user=r,
|
favorites = FavoriteChart.objects.filter(user=r,
|
||||||
workouttype__in=[workouttype,'both']).order_by("id")
|
workouttype__in=[workouttype,'both']).order_by("id")
|
||||||
|
maxfav = len(favorites)-1
|
||||||
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# check if favoritenr is not out of range
|
# check if favoritenr is not out of range
|
||||||
|
|||||||
Reference in New Issue
Block a user