diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index de3698ac..7f4d23c0 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -1379,16 +1379,28 @@ def default_class(r,w,race): if standards.count()==0: # omit weight - standards = CourseStandard.objects.filter(agemin__lt=age,agemax__gt=age, - boatclass=boatclass, - adaptiveclass=adaptiveclass, - boattype=boattype, - ).order_by("agemax","-agemin","boattype","sex") + standards = CourseStandard.objects.filter( + agemin__lt=age,agemax__gt=age, + boatclass=boatclass, + adaptiveclass=adaptiveclass, + boattype=boattype, + ).order_by( + "agemax","-agemin","boattype","sex","weightcategory", + "referencespeed" + ) if standards.count()==0: - standards = CourseStandard.objects.filter(agemin__lt=age,agemax__gt=age, - boattype=boattype).order_by("agemax","-agemin","boattype","sex") + standards = CourseStandard.objects.filter( + agemin__lt=age,agemax__gt=age, + boattype=boattype + ).order_by( + "agemax","-agemin","boattype","sex", + "weightcategory","referencespeed") if standards.count()==0: - standards = CourseStandard.objects.filter(agemin__lt=age,agemax__gt=age).order_by("agemax","-agemin","boattype","sex") + standards = CourseStandard.objects.filter( + agemin__lt=age,agemax__gt=age + ).order_by( + "agemax","-agemin","boattype","sex", + "weightcategory","referencespeed") if standards.count()==0: # boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,