Private
Public Access
1
0

Merge branch 'release/v12.06'

This commit is contained in:
Sander Roosendaal
2020-04-06 09:47:54 +02:00
6 changed files with 20 additions and 18 deletions

View File

@@ -750,7 +750,7 @@ def update_workout_field_sql(workoutid,fieldname,value,debug=False):
table = 'rowers_workout'
query = "UPDATE %s SET %s = %s WHERE `id` = %s;" % (table,fieldname,value,workoutid)
with engine.connect() as conn, conn.begin():
result = conn.execute(query)

View File

@@ -363,10 +363,12 @@ class Team(models.Model):
"Basic user cannot be team manager"
)
if not can_add_team(manager):
raise ValidationError(
"Pro and Self-Coach users cannot have more than one team"
)
if not self.id:
# new model instance
if not can_add_team(manager):
raise ValidationError(
"Pro and Self-Coach users cannot have more than one team"
)
super(Team, self).save(*args,**kwargs)

View File

@@ -142,6 +142,7 @@ def is_protrial(user):
return False
ispromember = is_promember | is_protrial
can_have_teams = ispromember | is_coach
@@ -151,7 +152,7 @@ def can_add_team(user):
if is_coach(user):
return True
if ispromember(user):
if ispromember(user) or is_planmember(user):
otherteams = user.rower.get_managed_teams()
if otherteams.count() == 0:
return True
@@ -628,7 +629,7 @@ def is_team_member(user,team):
def can_view_team(user,team):
# user based - below untested
if user.rower.rowerplan == 'basic' and team.manager.rower.rowerplan != 'coach':
return False
return is_plantrial(user) or is_protrial(user)
# team is public
if team.private == 'open':
return True

View File

@@ -186,7 +186,6 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
except TypeError:
act = client.update_activity(res.id,activity_type=activity_type,
description=description)
result = update_workout_field_sql(workoutid,'uploadedtostrava',res.id,debug=debug)
try:
os.remove(filename)

View File

@@ -106,8 +106,8 @@
<tr>
<td>Create and manage groups.</td>
<td>&nbsp;</td>
<td>&#10004;</td>
<td>&#10004;</td>
<td>&#10004; (max 1)</td>
<td>&#10004; (max 1)</td>
<td>&#10004;</td>
<td>&#10004;</td>
</tr>
@@ -311,17 +311,17 @@
<h2>Coach and Self-Coach Membership</h2>
<p>Rowsandall.com's Training Planning functionality
is part of the paid "Self-Coach" and "Coach" plans.</p>
<p>On the "Self-Coach" plan, you can plan your own sessions.</p>
<p>On the "Coach" plan, you can establish teams, see workouts done by
athletes on your team, and plan individual and group sessions for your
athletes.
</p>
<p>The Coach plan functionality listed is available to the coach only.
Individual athletes
can purchase upgrades to "Pro" and "Self-Coach" plans.
@@ -331,7 +331,7 @@
The Coach plans come in two versions: free and paid. On the free coach plan,
you can only have athletes who are on the PRO paid plans or higher, and you
cannot upload any workouts to your own account. Some of the advanced Analysis functionality
becomes available when the athlete group is larger than 4.
becomes available when the athlete group is larger than 4.
On the paid
plans, your athletes can be on the free plan, and you have full access to the
site functionality for your own workouts and those of your athletes.
@@ -363,7 +363,7 @@
<p>Do not hesitate to contact us at <a href="mailto:info@rowsandall.com">info@rowsandall.com</a>
with any payment related question you have.</p>
</li>
</ul>
@@ -372,4 +372,3 @@
{% block sidebar %}
{% include 'menu_help.html' %}
{% endblock %}

View File

@@ -651,7 +651,8 @@ def team_edit_view(request, team_id=0):
})
@login_required()
@user_passes_test(can_add_team,login_url="/rowers/paidplans",redirect_field_name=None)
@user_passes_test(can_add_team,login_url="/rowers/paidplans",redirect_field_name=None,
message="You need to upgrade or log in to access this functionality")
def team_create_view(request):
r = getrequestrower(request)