now working with new otw power
This commit is contained in:
@@ -1147,6 +1147,7 @@ class Alert(models.Model):
|
||||
verbose_name='Boat Type',default='1x')
|
||||
|
||||
|
||||
|
||||
def __str__(self):
|
||||
metricdict = {key:value for (key,value) in parchoicesy1}
|
||||
stri = u'Alert {name} on {metric} for {workouttype} - running on {first_name} every {period} days'.format(
|
||||
@@ -2778,6 +2779,7 @@ class Workout(models.Model):
|
||||
workoutsources = mytypes.workoutsources
|
||||
privacychoices = mytypes.privacychoices
|
||||
adaptivetypes = mytypes.adaptivetypes
|
||||
boatbrands = mytypes.boatbrands
|
||||
|
||||
user = models.ForeignKey(Rower,on_delete=models.CASCADE)
|
||||
team = models.ManyToManyField(Team,blank=True)
|
||||
@@ -2792,6 +2794,8 @@ class Workout(models.Model):
|
||||
boattype = models.CharField(choices=boattypes,max_length=50,
|
||||
default='1x',
|
||||
verbose_name = 'Boat Type')
|
||||
boatbrand = models.CharField(choices=boatbrands,max_length=50,
|
||||
default='',verbose_name = 'Boat Brand')
|
||||
adaptiveclass = models.CharField(choices=adaptivetypes,max_length=50,
|
||||
default='None',
|
||||
verbose_name='Adaptive Classification')
|
||||
@@ -3450,7 +3454,7 @@ class AdvancedWorkoutForm(ModelForm):
|
||||
|
||||
class Meta:
|
||||
model = Workout
|
||||
fields = ['boattype','weightvalue']
|
||||
fields = ['boattype','weightvalue','boatbrand']
|
||||
|
||||
class RowerExportForm(ModelForm):
|
||||
class Meta:
|
||||
|
||||
@@ -423,3 +423,75 @@ privacychoices = (
|
||||
('private','Private'),
|
||||
('visible','Visible'),
|
||||
)
|
||||
|
||||
boatbrands = (
|
||||
('other','Other'),
|
||||
('alden','Alden Rowing'),
|
||||
('averowing','AveRowing Boats'),
|
||||
('aylings','Aylings'),
|
||||
('bbg','BBG'),
|
||||
('burgashell','Burgashell'),
|
||||
('burton','Burton Water Sports'),
|
||||
('douglas','Carl Douglas Racing Shells'),
|
||||
('carbocraft','Carbocraft'),
|
||||
('colley','Colley'),
|
||||
('cucchietti','Cucchietti'),
|
||||
('dirigo','Dirigo'),
|
||||
('drew','Drew Harrison Racing'),
|
||||
('echo','Echo Rowing'),
|
||||
('edon','Edon TS515 Sculling Boats'),
|
||||
('edwin','Edwin Phelps'),
|
||||
('empacher','Empacher'),
|
||||
('eton','Eton Racing Boats (ERB)'),
|
||||
('euro','Euro Diffusions'),
|
||||
('filippi','Filippi Boats'),
|
||||
('fluidesign','Fluidesign'),
|
||||
('dragon','Flying Dragon Boat Co (Huangzhou, China)'),
|
||||
('gig','Gig Harbor Boat Works'),
|
||||
('sharrow','George Sharrow Racing Shells'),
|
||||
('harris','Harris'),
|
||||
('hitech','Hi-Tech'),
|
||||
('hudson','Hudson Boatworks'),
|
||||
('janousek','Janousek Racing Boats'),
|
||||
('waugh','John Waugh Racing Boats'),
|
||||
('laszlo','Laszlo Boats NZ'),
|
||||
('leo','Leo Coastal Rowing'),
|
||||
('levator','Levator Boatworks'),
|
||||
('liangjin','Liangjin Boat'),
|
||||
('liteboat','LiteBoat'),
|
||||
('littleriver','Little River Marine'),
|
||||
('kaschper','Kaschper Racing Shells'),
|
||||
('kanghua','Kanghua'),
|
||||
('king','King Racing Shells'),
|
||||
('kiwi','Kiwi International Rowing Skiffs (KIRS)'),
|
||||
('lola','Lola Aylings'),
|
||||
('maas','Maas Rowing Shells'),
|
||||
('maas','Maas Boat (coastal)'),
|
||||
('nelo','Nelo Rowing'),
|
||||
('owen','Owen'),
|
||||
('peinert','Peinert'),
|
||||
('pocock','Pocock Racing Shells'),
|
||||
('race1','Race 1 Australia'),
|
||||
('radley','Radley'),
|
||||
('resolute','Resolute Racing Shells'),
|
||||
('salani','Salani'),
|
||||
('schoenbrod','Helmut Schoenbrod'),
|
||||
('salterbros','Salter Bros'),
|
||||
('sims','Ray Sims'),
|
||||
('slracing','SL Racing'),
|
||||
('stampfli','Stämpfli Racing Boats'),
|
||||
('sutton','Sutton'),
|
||||
('swastik','Swastik fibchem industry'),
|
||||
('swift','Swift Racing'),
|
||||
('sykes','Sykes Racing'),
|
||||
('vandusen','Van Dusen'),
|
||||
('vega','Vega'),
|
||||
('vespoli','Vespoli'),
|
||||
('vicente','Vicente Dors'),
|
||||
('virus','Virus'),
|
||||
('whitehall','Whitehall Rowing'),
|
||||
('wiersma','Roeiwerf Wiersma'),
|
||||
('wintech','WinTech Racing'),
|
||||
('worcester','Worcester Oar & Paddle (Joe Garafolo)'),
|
||||
('swastik','Swastik Boats'),
|
||||
)
|
||||
|
||||
@@ -20,7 +20,7 @@ DESCRIPTOR = _descriptor.FileDescriptor(
|
||||
package='otw_power_calculator',
|
||||
syntax='proto3',
|
||||
serialized_options=None,
|
||||
serialized_pb=_b('\n\x1aotw-power-calculator.proto\x12\x14otw_power_calculator\"\xaa\x01\n\x13WorkoutPowerRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08\x62oattype\x18\x02 \x01(\t\x12\x10\n\x08\x63rewmass\x18\x03 \x01(\x01\x12\x15\n\rpowermeasured\x18\x04 \x01(\x08\x12\x13\n\x0bprogressurl\x18\x05 \x01(\t\x12\x0e\n\x06secret\x18\x06 \x01(\t\x12\x0e\n\x06silent\x18\x07 \x01(\x08\x12\x11\n\tboatclass\x18\x08 \x01(\t\"#\n\x11\x43\x61lculationResult\x12\x0e\n\x06result\x18\x01 \x01(\x05\x32j\n\x05Power\x12\x61\n\tCalcPower\x12).otw_power_calculator.WorkoutPowerRequest\x1a\'.otw_power_calculator.CalculationResult\"\x00\x62\x06proto3')
|
||||
serialized_pb=_b('\n\x1aotw-power-calculator.proto\x12\x14otw_power_calculator\"\xc0\x01\n\x13WorkoutPowerRequest\x12\x10\n\x08\x66ilename\x18\x01 \x01(\t\x12\x10\n\x08\x62oattype\x18\x02 \x01(\t\x12\x10\n\x08\x63rewmass\x18\x03 \x01(\x01\x12\x15\n\rpowermeasured\x18\x04 \x01(\x08\x12\x13\n\x0bprogressurl\x18\x05 \x01(\t\x12\x0e\n\x06secret\x18\x06 \x01(\t\x12\x0e\n\x06silent\x18\x07 \x01(\x08\x12\x11\n\tboatclass\x18\x08 \x01(\t\x12\x14\n\x0c\x63oastalbrand\x18\t \x01(\t\"#\n\x11\x43\x61lculationResult\x12\x0e\n\x06result\x18\x01 \x01(\x05\x32j\n\x05Power\x12\x61\n\tCalcPower\x12).otw_power_calculator.WorkoutPowerRequest\x1a\'.otw_power_calculator.CalculationResult\"\x00\x62\x06proto3')
|
||||
)
|
||||
|
||||
|
||||
@@ -89,6 +89,13 @@ _WORKOUTPOWERREQUEST = _descriptor.Descriptor(
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
serialized_options=None, file=DESCRIPTOR),
|
||||
_descriptor.FieldDescriptor(
|
||||
name='coastalbrand', full_name='otw_power_calculator.WorkoutPowerRequest.coastalbrand', index=8,
|
||||
number=9, type=9, cpp_type=9, label=1,
|
||||
has_default_value=False, default_value=_b("").decode('utf-8'),
|
||||
message_type=None, enum_type=None, containing_type=None,
|
||||
is_extension=False, extension_scope=None,
|
||||
serialized_options=None, file=DESCRIPTOR),
|
||||
],
|
||||
extensions=[
|
||||
],
|
||||
@@ -102,7 +109,7 @@ _WORKOUTPOWERREQUEST = _descriptor.Descriptor(
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=53,
|
||||
serialized_end=223,
|
||||
serialized_end=245,
|
||||
)
|
||||
|
||||
|
||||
@@ -132,8 +139,8 @@ _CALCULATIONRESULT = _descriptor.Descriptor(
|
||||
extension_ranges=[],
|
||||
oneofs=[
|
||||
],
|
||||
serialized_start=225,
|
||||
serialized_end=260,
|
||||
serialized_start=247,
|
||||
serialized_end=282,
|
||||
)
|
||||
|
||||
DESCRIPTOR.message_types_by_name['WorkoutPowerRequest'] = _WORKOUTPOWERREQUEST
|
||||
@@ -162,8 +169,8 @@ _POWER = _descriptor.ServiceDescriptor(
|
||||
file=DESCRIPTOR,
|
||||
index=0,
|
||||
serialized_options=None,
|
||||
serialized_start=262,
|
||||
serialized_end=368,
|
||||
serialized_start=284,
|
||||
serialized_end=390,
|
||||
methods=[
|
||||
_descriptor.MethodDescriptor(
|
||||
name='CalcPower',
|
||||
|
||||
@@ -1839,7 +1839,7 @@ def handle_sendemailfile(first_name, last_name, email, csvfile,**kwargs):
|
||||
|
||||
|
||||
@app.task(bind=True)
|
||||
def handle_otwsetpower(self,f1, boattype, boatclass, weightvalue,
|
||||
def handle_otwsetpower(self,f1, boattype, boatclass, coastalbrand, weightvalue,
|
||||
first_name, last_name, email, workoutid,
|
||||
**kwargs):
|
||||
|
||||
@@ -1926,6 +1926,7 @@ def handle_otwsetpower(self,f1, boattype, boatclass, weightvalue,
|
||||
response = stub.CalcPower(calculator_pb2.WorkoutPowerRequest(
|
||||
filename = csvfile,
|
||||
boattype = boattype,
|
||||
coastalbrand = coastalbrand,
|
||||
crewmass = weightvalue,
|
||||
powermeasured = powermeasured,
|
||||
progressurl = progressurl,
|
||||
|
||||
@@ -2949,9 +2949,11 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
|
||||
#go_service = form.cleaned_data['go_service']
|
||||
boattype = form.cleaned_data['boattype']
|
||||
weightvalue = form.cleaned_data['weightvalue']
|
||||
coastalbrand = form.cleaned_data['boatbrand']
|
||||
boatclass = w.workouttype
|
||||
w.boattype = boattype
|
||||
w.weightvalue = weightvalue
|
||||
w.boatbrand = coastalbrand
|
||||
w.save()
|
||||
|
||||
|
||||
@@ -2987,7 +2989,7 @@ def workout_otwsetpower_view(request,id=0,message="",successmessage=""):
|
||||
emailaddress = u.email
|
||||
|
||||
job = myqueue(queuelow,
|
||||
handle_otwsetpower,f1,boattype,boatclass,
|
||||
handle_otwsetpower,f1,boattype,boatclass,coastalbrand,
|
||||
weightvalue,
|
||||
first_name,last_name,emailaddress,encoder.decode_hex(id),
|
||||
ps=[r.p0,r.p1,r.p2,r.p3],
|
||||
|
||||
Reference in New Issue
Block a user