diff --git a/rowers/dataprep.py b/rowers/dataprep.py index f0849105..acb1ff77 100644 --- a/rowers/dataprep.py +++ b/rowers/dataprep.py @@ -572,9 +572,15 @@ def new_workout_from_file(r,f2, with zipfile.ZipFile(f2) as z: # for now, we're getting only the first file # from the NK zip file (issue #69 on bitbucket) - f2 = z.extract(z.namelist()[0],path='media/') - fileformat = fileformat[2] + for fname in z.namelist(): + f3 = z.extract(fname,path='media/') + id,message,f2 = new_workout_from_file(r,f3, + workouttype=workouttype, + makeprivate=makeprivate, + title = title, + notes='') os.remove(f_to_be_deleted) + return id,message,f2 # Some people try to upload Concept2 logbook summaries if fileformat == 'c2log': diff --git a/rowers/forms.py b/rowers/forms.py index e9e4f31e..da1c5ed0 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -90,6 +90,24 @@ class UploadOptionsForm(forms.Form): class Meta: fields = ['make_plot','plottype','upload_toc2','makeprivate'] +# The form to indicate additional actions to be performed immediately +# after a successful upload. This version allows the Team manager to select +# a team member +class TeamUploadOptionsForm(forms.Form): + plotchoices = ( + ('timeplot','Time Plot'), + ('distanceplot','Distance Plot'), + ('pieplot','Pie Chart'), + ) + make_plot = forms.BooleanField(initial=False,required=False) + plottype = forms.ChoiceField(required=False, + choices=plotchoices, + initial='timeplot', + label='Plot Type') + + class Meta: + fields = ['make_plot','plottype'] + # This form is used on the Analysis page to add a custom distance/time # trial and predict the pace class PredictedPieceForm(forms.Form): diff --git a/rowers/teams.py b/rowers/teams.py index dcf7371b..6ab792d3 100644 --- a/rowers/teams.py +++ b/rowers/teams.py @@ -159,7 +159,7 @@ def create_request(team,user): if r2 in Rower.objects.filter(team=team): return (0,'Already a member of that team') - if count_club_members(team.manager)+count_invites(team.manager) < r.clubsize: + if count_club_members(team.manager)+count_invites(team.manager) <= r.clubsize: codes = [i.code for i in TeamRequest.objects.all()] code = uuid.uuid4().hex[:10].upper() # prevent duplicates @@ -200,7 +200,7 @@ def create_invite(team,manager,user=None,email=''): except Rower.MultipleObjectsReturned: return (0,'There is more than one user with that email address') - if count_club_members(team.manager)+count_invites(team.manager) < r.clubsize: + if count_club_members(team.manager)+count_invites(team.manager) <= r.clubsize: codes = [i.code for i in TeamInvite.objects.all()] code = uuid.uuid4().hex[:10].upper() # prevent duplicates diff --git a/rowers/templates/400.html b/rowers/templates/400.html index caf15419..43d7e090 100644 --- a/rowers/templates/400.html +++ b/rowers/templates/400.html @@ -1,4 +1,4 @@ -{% extends "bases.html" %} +{% extends "base.html" %} {% load staticfiles %} {% load rowerfilters %} diff --git a/rowers/templates/403.html b/rowers/templates/403.html index fc4b11cf..316b4872 100644 --- a/rowers/templates/403.html +++ b/rowers/templates/403.html @@ -1,4 +1,4 @@ -{% extends "bases.html" %} +{% extends "base.html" %} {% load staticfiles %} {% load rowerfilters %} diff --git a/rowers/templates/404.html b/rowers/templates/404.html index 69d2b396..0116bd84 100644 --- a/rowers/templates/404.html +++ b/rowers/templates/404.html @@ -1,4 +1,4 @@ -{% extends "bases.html" %} +{% extends "base.html" %} {% load staticfiles %} {% load rowerfilters %} diff --git a/rowers/templates/500.html b/rowers/templates/500.html index cf988e28..258d606b 100644 --- a/rowers/templates/500.html +++ b/rowers/templates/500.html @@ -1,4 +1,4 @@ -{% extends "bases.html" %} +{% extends "base.html" %} {% load staticfiles %} {% load rowerfilters %} diff --git a/rowers/templates/base.html b/rowers/templates/base.html index c5677acc..8e6487a2 100644 --- a/rowers/templates/base.html +++ b/rowers/templates/base.html @@ -1,5 +1,6 @@ {% load cookielaw_tags %} {% load analytical %} +{% load rowerfilters %} @@ -143,13 +144,17 @@ {% endif %}
- {% if user.is_authenticated and teams %} + {% if user.is_authenticated and user|has_teams %}
- {% if user.is_authenticated and teams %} + {% if user.is_authenticated and user|user_teams %}