Private
Public Access
1
0

better names for categories

This commit is contained in:
Sander Roosendaal
2020-05-27 13:16:51 +02:00
parent eb41a5f17f
commit 8bfbb2bdf8
5 changed files with 56 additions and 23 deletions

View File

@@ -243,15 +243,9 @@ def update_records(url=c2url,verbose=True):
class CalcAgePerformance(models.Model): class CalcAgePerformance(models.Model):
weightcategories = ( weightcategories = mytypes.weightcategories
('hwt','heavy-weight'),
('lwt','light-weight'),
)
sexcategories = ( sexcategories = mytypes.sexcategories
('male','male'),
('female','female'),
)
weightcategory = models.CharField(default="hwt", weightcategory = models.CharField(default="hwt",
max_length=30, max_length=30,
@@ -288,10 +282,7 @@ class PowerTimeFitnessMetric(models.Model):
@python_2_unicode_compatible @python_2_unicode_compatible
class C2WorldClassAgePerformance(models.Model): class C2WorldClassAgePerformance(models.Model):
weightcategories = ( weightcategories = mytypes.weightcategories
('hwt','heavy-weight'),
('lwt','light-weight'),
)
sexcategories = ( sexcategories = (
('male','male'), ('male','male'),
@@ -593,10 +584,8 @@ sexcategories = (
('female','female'), ('female','female'),
('not specified','not specified'), ('not specified','not specified'),
) )
weightcategories = (
('hwt','heavy-weight'), weightcategories = mytypes.weightcategories
('lwt','light-weight'),
)
# Plan # Plan

View File

@@ -316,13 +316,23 @@ boattypes = (
) )
adaptivetypes = ( adaptivetypes = (
('None','None'), ('None','Open'),
('PR1', 'PR1 (Arms and Shoulders)'), ('PR1', 'PR1 (Arms and Shoulders)'),
('PR2', 'PR2 (Trunk and Arms)'), ('PR2', 'PR2 (Trunk and Arms)'),
('PR3', 'PR3 (Leg Trunk and Arms)'), ('PR3', 'PR3 (Leg Trunk and Arms)'),
('FES', 'FES (Functional Electrical Stimulation)'), ('FES', 'FES (Functional Electrical Stimulation)'),
) )
weightcategories = (
('hwt','open-weight'),
('lwt','light-weight'),
)
sexcategories = (
('male','Open'),
('female','Female'),
)
waterboattype = [i[0] for i in boattypes] waterboattype = [i[0] for i in boattypes]
privacychoices = ( privacychoices = (

View File

@@ -84,12 +84,13 @@ def save_scoring(name,user,filename,id=0,notes=""):
except KeyError: except KeyError:
weightclass = 'hwt' weightclass = 'hwt'
adaptiveclass = 'None'
try: try:
adaptiveclass = row['AdaptiveClass'] adaptiveclass = row['AdaptiveClass']
if adaptiveclass.lower() in ['o','open','none','no']: if adaptiveclass.lower() in ['o','open','none','no']:
adaptiveclass = None adaptiveclass = 'None'
except KeyError: except KeyError:
adaptiveclass = None adaptiveclass = 'None'
try: try:
skillclass = row['SkillClass'] skillclass = row['SkillClass']

View File

@@ -57,9 +57,9 @@
<td>{{ standard.coursetime }}</td> <td>{{ standard.coursetime }}</td>
<td>{{ standard.boatclass }}</td> <td>{{ standard.boatclass }}</td>
<td>{{ standard.boattype }}</td> <td>{{ standard.boattype }}</td>
<td>{{ standard.sex }}</td> <td>{{ standard.sex|sex }}</td>
<td>{{ standard.weightclass }}</td> <td>{{ standard.weightclass|weight }}</td>
<td>{{ standard.adaptiveclass }}</td> <td>{{ standard.adaptiveclass|adaptive }}</td>
<td>{{ standard.skillclass }}</td> <td>{{ standard.skillclass }}</td>
<td>{{ standard.agemin }}/{{ standard.agemax }}</td> <td>{{ standard.agemin }}/{{ standard.agemax }}</td>
</tr> </tr>

View File

@@ -22,7 +22,7 @@ from rowers import c2stuff, runkeeperstuff
from rowers.c2stuff import c2_open from rowers.c2stuff import c2_open
from rowers.runkeeperstuff import runkeeper_open from rowers.runkeeperstuff import runkeeper_open
from rowers.rower_rules import is_coach_user, is_workout_user, isplanmember,ispromember from rowers.rower_rules import is_coach_user, is_workout_user, isplanmember,ispromember
from rowers.mytypes import otwtypes from rowers.mytypes import otwtypes,adaptivetypes,sexcategories,weightcategories
from rowers.utils import NoTokenError from rowers.utils import NoTokenError
import rowers.payments as payments import rowers.payments as payments
@@ -38,6 +38,39 @@ from django.template.defaultfilters import stringfilter
from six import string_types from six import string_types
@register.filter
def adaptive(s):
u = s
for e,v in adaptivetypes:
if e.lower() == u.lower():
u = v
continue
return u
@register.filter
def sex(s):
u = s
for e,v in sexcategories:
if e.lower() == u.lower():
u = v
continue
return u
@register.filter
def weight(s):
u = s
for e,v in weightcategories:
if e.lower() == u.lower():
u = v
continue
return u
@register.filter @register.filter
def sigdig(value, digits = 3): def sigdig(value, digits = 3):
try: try: