diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 92166a78..de3698ac 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -1372,8 +1372,9 @@ def default_class(r,w,race): boatclass=boatclass, adaptiveclass=adaptiveclass, boattype=boattype, - weightclass=weightclass - ).order_by("agemax","-agemin","boattype") + weightclass=weightclass, + sex=sex, + ).order_by("agemax","-agemin","boattype","sex") if standards.count()==0: @@ -1382,12 +1383,12 @@ def default_class(r,w,race): boatclass=boatclass, adaptiveclass=adaptiveclass, boattype=boattype, - ) + ).order_by("agemax","-agemin","boattype","sex") if standards.count()==0: standards = CourseStandard.objects.filter(agemin__lt=age,agemax__gt=age, - boattype=boattype) + boattype=boattype).order_by("agemax","-agemin","boattype","sex") if standards.count()==0: - standards = CourseStandard.objects.filter(agemin__lt=age,agemax__gt=age) + standards = CourseStandard.objects.filter(agemin__lt=age,agemax__gt=age).order_by("agemax","-agemin","boattype","sex") if standards.count()==0: # boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,