From a128bdd530bdfcabaf8fbf9e1dea6a50778f0050 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 21 Jun 2020 18:16:35 +0200 Subject: [PATCH] lw --- rowers/plannedsessions.py | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index de3698ac..2c649a6b 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -1379,16 +1379,25 @@ 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" + ) 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") 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") if standards.count()==0: # boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,