better names for categories
This commit is contained in:
@@ -243,15 +243,9 @@ def update_records(url=c2url,verbose=True):
|
||||
|
||||
|
||||
class CalcAgePerformance(models.Model):
|
||||
weightcategories = (
|
||||
('hwt','heavy-weight'),
|
||||
('lwt','light-weight'),
|
||||
)
|
||||
weightcategories = mytypes.weightcategories
|
||||
|
||||
sexcategories = (
|
||||
('male','male'),
|
||||
('female','female'),
|
||||
)
|
||||
sexcategories = mytypes.sexcategories
|
||||
|
||||
weightcategory = models.CharField(default="hwt",
|
||||
max_length=30,
|
||||
@@ -288,10 +282,7 @@ class PowerTimeFitnessMetric(models.Model):
|
||||
|
||||
@python_2_unicode_compatible
|
||||
class C2WorldClassAgePerformance(models.Model):
|
||||
weightcategories = (
|
||||
('hwt','heavy-weight'),
|
||||
('lwt','light-weight'),
|
||||
)
|
||||
weightcategories = mytypes.weightcategories
|
||||
|
||||
sexcategories = (
|
||||
('male','male'),
|
||||
@@ -593,10 +584,8 @@ sexcategories = (
|
||||
('female','female'),
|
||||
('not specified','not specified'),
|
||||
)
|
||||
weightcategories = (
|
||||
('hwt','heavy-weight'),
|
||||
('lwt','light-weight'),
|
||||
)
|
||||
|
||||
weightcategories = mytypes.weightcategories
|
||||
|
||||
|
||||
# Plan
|
||||
|
||||
@@ -316,13 +316,23 @@ boattypes = (
|
||||
)
|
||||
|
||||
adaptivetypes = (
|
||||
('None','None'),
|
||||
('None','Open'),
|
||||
('PR1', 'PR1 (Arms and Shoulders)'),
|
||||
('PR2', 'PR2 (Trunk and Arms)'),
|
||||
('PR3', 'PR3 (Leg Trunk and Arms)'),
|
||||
('FES', 'FES (Functional Electrical Stimulation)'),
|
||||
)
|
||||
|
||||
weightcategories = (
|
||||
('hwt','open-weight'),
|
||||
('lwt','light-weight'),
|
||||
)
|
||||
|
||||
sexcategories = (
|
||||
('male','Open'),
|
||||
('female','Female'),
|
||||
)
|
||||
|
||||
waterboattype = [i[0] for i in boattypes]
|
||||
|
||||
privacychoices = (
|
||||
|
||||
@@ -84,12 +84,13 @@ def save_scoring(name,user,filename,id=0,notes=""):
|
||||
except KeyError:
|
||||
weightclass = 'hwt'
|
||||
|
||||
adaptiveclass = 'None'
|
||||
try:
|
||||
adaptiveclass = row['AdaptiveClass']
|
||||
if adaptiveclass.lower() in ['o','open','none','no']:
|
||||
adaptiveclass = None
|
||||
adaptiveclass = 'None'
|
||||
except KeyError:
|
||||
adaptiveclass = None
|
||||
adaptiveclass = 'None'
|
||||
|
||||
try:
|
||||
skillclass = row['SkillClass']
|
||||
|
||||
@@ -57,9 +57,9 @@
|
||||
<td>{{ standard.coursetime }}</td>
|
||||
<td>{{ standard.boatclass }}</td>
|
||||
<td>{{ standard.boattype }}</td>
|
||||
<td>{{ standard.sex }}</td>
|
||||
<td>{{ standard.weightclass }}</td>
|
||||
<td>{{ standard.adaptiveclass }}</td>
|
||||
<td>{{ standard.sex|sex }}</td>
|
||||
<td>{{ standard.weightclass|weight }}</td>
|
||||
<td>{{ standard.adaptiveclass|adaptive }}</td>
|
||||
<td>{{ standard.skillclass }}</td>
|
||||
<td>{{ standard.agemin }}/{{ standard.agemax }}</td>
|
||||
</tr>
|
||||
|
||||
@@ -22,7 +22,7 @@ from rowers import c2stuff, runkeeperstuff
|
||||
from rowers.c2stuff import c2_open
|
||||
from rowers.runkeeperstuff import runkeeper_open
|
||||
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
|
||||
|
||||
import rowers.payments as payments
|
||||
@@ -38,6 +38,39 @@ from django.template.defaultfilters import stringfilter
|
||||
|
||||
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
|
||||
def sigdig(value, digits = 3):
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user