From a128bdd530bdfcabaf8fbf9e1dea6a50778f0050 Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 21 Jun 2020 18:16:35 +0200 Subject: [PATCH 1/2] 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, From c04954daed6467a45e9b6843c2ae73ba7221fd3f Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sun, 21 Jun 2020 18:19:17 +0200 Subject: [PATCH 2/2] filter by ref speed --- rowers/plannedsessions.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py index 2c649a6b..7f4d23c0 100644 --- a/rowers/plannedsessions.py +++ b/rowers/plannedsessions.py @@ -1385,19 +1385,22 @@ def default_class(r,w,race): adaptiveclass=adaptiveclass, boattype=boattype, ).order_by( - "agemax","-agemin","boattype","sex","weightcategory" + "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") + "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") + "agemax","-agemin","boattype","sex", + "weightcategory","referencespeed") if standards.count()==0: # boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,