Merge branch 'release/v13.27'
This commit is contained in:
+27
-27
@@ -40,23 +40,23 @@ def time_in_path(df,p,maxmin='max',getall=False,name='unknown',logfile=None):
|
|||||||
if len(df[b==2]):
|
if len(df[b==2]):
|
||||||
if logfile is not None:
|
if logfile is not None:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = bytes('{t}'.format(t=time.strftime('%b-%d-%Y_%H%M', t)),'utf-8')
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
f.write('\n')
|
f.write(b'\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(name)
|
f.write(bytes(name,'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(maxmin)
|
f.write(bytes(maxmin,'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(str(getall))
|
f.write(bytes(str(getall),'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(str(len(df[b==2])))
|
f.write(bytes(str(len(df[b==2])),'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
if len(df[b==2])>1:
|
if len(df[b==2])>1:
|
||||||
f.write(' passes found')
|
f.write(b' passes found')
|
||||||
else:
|
else:
|
||||||
f.write(' pass found')
|
f.write(b' pass found')
|
||||||
if getall:
|
if getall:
|
||||||
return df[b==2]['time'],df[b==2]['cum_dist']
|
return df[b==2]['time'],df[b==2]['cum_dist']
|
||||||
else:
|
else:
|
||||||
@@ -64,20 +64,20 @@ def time_in_path(df,p,maxmin='max',getall=False,name='unknown',logfile=None):
|
|||||||
|
|
||||||
if logfile is not None:
|
if logfile is not None:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = bytes('{t}'.format(t=time.strftime('%b-%d-%Y_%H%M', t)),'utf-8')
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
f.write('\n')
|
f.write(b'\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(name)
|
f.write(bytes(name,'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(maxmin)
|
f.write(bytes(maxmin,'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(str(getall))
|
f.write(bytes(str(getall),'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(str(len(df[b==2])))
|
f.write(bytes(str(len(df[b==2])),'utf-8'))
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write(' pass not found')
|
f.write(b' pass not found')
|
||||||
raise InvalidTrajectoryError("Trajectory doesn't go through path")
|
raise InvalidTrajectoryError("Trajectory doesn't go through path")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,6 @@ def garmin_getworkout(garminid,r,activity):
|
|||||||
offset = activity['startTimeOffsetInSeconds']
|
offset = activity['startTimeOffsetInSeconds']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
offset = 0
|
offset = 0
|
||||||
print(offset)
|
|
||||||
durationseconds = activity['durationInSeconds']
|
durationseconds = activity['durationInSeconds']
|
||||||
duration = dataprep.totaltime_sec_to_string(durationseconds)
|
duration = dataprep.totaltime_sec_to_string(durationseconds)
|
||||||
activitytype = activity['activityType']
|
activitytype = activity['activityType']
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ def interactive_hr_piechart(df,rower,title,totalseconds=0):
|
|||||||
qry = 'hr < {ut2}'.format(ut2=rower.ut2)
|
qry = 'hr < {ut2}'.format(ut2=rower.ut2)
|
||||||
frac_lut2 = totalseconds*df.query(qry)['deltat'].sum()/sumtimehr
|
frac_lut2 = totalseconds*df.query(qry)['deltat'].sum()/sumtimehr
|
||||||
|
|
||||||
|
|
||||||
qry = '{ut2} <= hr < {ut1}'.format(ut1=rower.ut1,ut2=rower.ut2)
|
qry = '{ut2} <= hr < {ut1}'.format(ut1=rower.ut1,ut2=rower.ut2)
|
||||||
frac_ut2 = totalseconds*df.query(qry)['deltat'].sum()/sumtimehr
|
frac_ut2 = totalseconds*df.query(qry)['deltat'].sum()/sumtimehr
|
||||||
|
|
||||||
|
|||||||
@@ -1385,7 +1385,7 @@ def default_class(r,w,race):
|
|||||||
adaptiveclass=adaptiveclass,
|
adaptiveclass=adaptiveclass,
|
||||||
boattype=boattype,
|
boattype=boattype,
|
||||||
).order_by(
|
).order_by(
|
||||||
"agemax","-agemin","boattype","sex","weightcategory",
|
"agemax","-agemin","boattype","sex","weightclass",
|
||||||
"referencespeed"
|
"referencespeed"
|
||||||
)
|
)
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
@@ -1394,7 +1394,7 @@ def default_class(r,w,race):
|
|||||||
boattype=boattype
|
boattype=boattype
|
||||||
).order_by(
|
).order_by(
|
||||||
"agemax","-agemin","boattype","sex",
|
"agemax","-agemin","boattype","sex",
|
||||||
"weightcategory","referencespeed")
|
"weightclass","referencespeed")
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
standards = CourseStandard.objects.filter(
|
standards = CourseStandard.objects.filter(
|
||||||
agemin__lt=age,agemax__gt=age
|
agemin__lt=age,agemax__gt=age
|
||||||
@@ -1404,15 +1404,15 @@ def default_class(r,w,race):
|
|||||||
|
|
||||||
if standards.count()==0:
|
if standards.count()==0:
|
||||||
# boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,
|
# boolean, boattype, boatclass, adaptiveclass, weightclass, sex, coursestandard,
|
||||||
return False,'1x','water',None,'hwt','male',None
|
return False,'1x','water',None,'hwt','male',5.0,None
|
||||||
|
|
||||||
if standards.count()>0:
|
if standards.count()>0:
|
||||||
# find optimum standard
|
# find optimum standard
|
||||||
s = standards[0]
|
s = standards[0]
|
||||||
return True,s.boattype,s.boatclass,s.adaptiveclass,s.weightclass,s.sex,s
|
return True,s.boattype,s.boatclass,s.adaptiveclass,s.weightclass,s.sex,s.referencespeed,s
|
||||||
|
|
||||||
# No Course Standard
|
# No Course Standard
|
||||||
return True,boattype,boatclass,adaptiveclass,weightclass,sex,None
|
return True,boattype,boatclass,adaptiveclass,weightclass,sex,5.0,None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1472,7 +1472,7 @@ def add_workout_indoorrace(ws,race,r,recordid=0,doregister=False):
|
|||||||
)
|
)
|
||||||
except IndoorVirtualRaceResult.DoesNotExist:
|
except IndoorVirtualRaceResult.DoesNotExist:
|
||||||
if doregister:
|
if doregister:
|
||||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,ws[0],race)
|
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,referencespeed,initialcategory = default_class(r,ws[0],race)
|
||||||
if hasinitial:
|
if hasinitial:
|
||||||
record = IndoorVirtualRaceResult(
|
record = IndoorVirtualRaceResult(
|
||||||
userid = r.id,
|
userid = r.id,
|
||||||
@@ -1483,6 +1483,7 @@ def add_workout_indoorrace(ws,race,r,recordid=0,doregister=False):
|
|||||||
boatclass=boatclass,
|
boatclass=boatclass,
|
||||||
sex=sex,
|
sex=sex,
|
||||||
age = age,
|
age = age,
|
||||||
|
referencespeed=referencespeed,
|
||||||
entrycategory=initialcategory,
|
entrycategory=initialcategory,
|
||||||
)
|
)
|
||||||
record.save()
|
record.save()
|
||||||
@@ -1624,7 +1625,7 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0,doregister=False):
|
|||||||
)
|
)
|
||||||
except VirtualRaceResult.DoesNotExist:
|
except VirtualRaceResult.DoesNotExist:
|
||||||
if doregister:
|
if doregister:
|
||||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,ws[0],race)
|
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,referencespeed,initialcategory = default_class(r,ws[0],race)
|
||||||
if hasinitial:
|
if hasinitial:
|
||||||
record = VirtualRaceResult(
|
record = VirtualRaceResult(
|
||||||
userid = r.id,
|
userid = r.id,
|
||||||
@@ -1637,8 +1638,10 @@ def add_workout_race(ws,race,r,splitsecond=0,recordid=0,doregister=False):
|
|||||||
sex=sex,
|
sex=sex,
|
||||||
age = age,
|
age = age,
|
||||||
entrycategory=initialcategory,
|
entrycategory=initialcategory,
|
||||||
|
referencespeed=referencespeed,
|
||||||
)
|
)
|
||||||
record.save()
|
record.save()
|
||||||
|
add_rower_race(r,race)
|
||||||
else:
|
else:
|
||||||
errors.append("Unable to find a suitable start category")
|
errors.append("Unable to find a suitable start category")
|
||||||
return result,comments,errors,0
|
return result,comments,errors,0
|
||||||
|
|||||||
+29
-16
@@ -197,9 +197,9 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip
|
|||||||
except:
|
except:
|
||||||
e = sys.exc_info()[0]
|
e = sys.exc_info()[0]
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = bytes('{t}'.format(t=time.strftime('%b-%d-%Y_%H%M', t)),'utf-8')
|
||||||
with open('stravalog.log','a') as f:
|
with open('stravalog.log','ab') as f:
|
||||||
f.write('\n')
|
f.write(b'\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(str(e))
|
f.write(str(e))
|
||||||
|
|
||||||
@@ -446,15 +446,15 @@ def handle_check_race_course(self,
|
|||||||
try:
|
try:
|
||||||
entrytimes,entrydistances = time_in_path(rowdata,paths[0],maxmin='max',getall=True,
|
entrytimes,entrydistances = time_in_path(rowdata,paths[0],maxmin='max',getall=True,
|
||||||
name=polygons[0].name,logfile=logfile)
|
name=polygons[0].name,logfile=logfile)
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = bytes('{t}'.format(t=time.strftime('%b-%d-%Y_%H%M', t)),'utf-8')
|
||||||
f.write('\n')
|
f.write(b'\n')
|
||||||
f.write('Course id {n}, Record id {m}'.format(n=courseid,m=recordid))
|
f.write(bytes('Course id {n}, Record id {m}'.format(n=courseid,m=recordid),'utf-8'))
|
||||||
f.write('\n')
|
f.write(b'\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write('Found {n} entrytimes'.format(n=len(entrytimes)))
|
f.write(bytes('Found {n} entrytimes'.format(n=len(entrytimes)),'utf-8'))
|
||||||
|
|
||||||
except InvalidTrajectoryError:
|
except InvalidTrajectoryError:
|
||||||
entrytimes = []
|
entrytimes = []
|
||||||
@@ -471,13 +471,13 @@ def handle_check_race_course(self,
|
|||||||
endseconds = []
|
endseconds = []
|
||||||
|
|
||||||
for startt in entrytimes:
|
for startt in entrytimes:
|
||||||
with open(logfile,'a') as f:
|
with open(logfile,'ab') as f:
|
||||||
t = time.localtime()
|
t = time.localtime()
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
timestamp = bytes('{t}'.format(t=time.strftime('%b-%d-%Y_%H%M', t)),'utf-8')
|
||||||
f.write('\n')
|
f.write(b'\n')
|
||||||
f.write(timestamp)
|
f.write(timestamp)
|
||||||
f.write(' ')
|
f.write(b' ')
|
||||||
f.write('Path starting at {t}'.format(t=startt))
|
f.write(bytes('Path starting at {t}'.format(t=startt),'utf-8'))
|
||||||
rowdata2 = rowdata[rowdata['time']>(startt-10.)]
|
rowdata2 = rowdata[rowdata['time']>(startt-10.)]
|
||||||
|
|
||||||
(
|
(
|
||||||
@@ -587,13 +587,26 @@ def handle_check_race_course(self,
|
|||||||
endsecond=endsecond,
|
endsecond=endsecond,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
with engine.connect() as conn, conn.begin():
|
with engine.connect() as conn, conn.begin():
|
||||||
result = conn.execute(query)
|
result = conn.execute(query)
|
||||||
|
|
||||||
conn.close()
|
conn.close()
|
||||||
engine.dispose()
|
engine.dispose()
|
||||||
|
|
||||||
|
# add times for all gates to log file
|
||||||
|
with open(logfile,'ab') as f:
|
||||||
|
t = time.localtime()
|
||||||
|
f.write(b'\n')
|
||||||
|
f.write(b' ')
|
||||||
|
f.write(b'--- LOG of all gate times---')
|
||||||
|
|
||||||
|
for path,polygon in zip(paths,polygons):
|
||||||
|
( secs,meters,completed) = coursetime_paths(rowdata2,
|
||||||
|
[path],polygons=[polygon],logfile=logfile)
|
||||||
|
with open(logfile,'ab') as f:
|
||||||
|
line = " time: {t} seconds, distance: {m} meters".format(t=secs,m=meters)
|
||||||
|
f.write(bytes(line,'utf-8'))
|
||||||
|
|
||||||
# send email
|
# send email
|
||||||
handle_sendemail_coursefail(
|
handle_sendemail_coursefail(
|
||||||
useremail,userfirstname,logfile
|
useremail,userfirstname,logfile
|
||||||
|
|||||||
@@ -34,10 +34,11 @@
|
|||||||
alt="connect with Polar" width="130"></a></p>
|
alt="connect with Polar" width="130"></a></p>
|
||||||
<p><a href="/rowers/me/tpauthorize/"><img src="/static/img/TP_logo_horz_2_color.png"
|
<p><a href="/rowers/me/tpauthorize/"><img src="/static/img/TP_logo_horz_2_color.png"
|
||||||
alt="connect with Polar" width="130"></a></p>
|
alt="connect with Polar" width="130"></a></p>
|
||||||
|
<!--
|
||||||
<p><a href="/rowers/me/garminauthorize"><img src="/static/img/garmin_badge_130.png"
|
<p><a href="/rowers/me/garminauthorize"><img src="/static/img/garmin_badge_130.png"
|
||||||
alt="connect with Garmin" with="130"></a></p>
|
alt="connect with Garmin" with="130"></a></p>
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ class GarminObjects(DjangoTestCase):
|
|||||||
self.assertEqual(len(data),2)
|
self.assertEqual(len(data),2)
|
||||||
|
|
||||||
def test_garmin_deregistration(self):
|
def test_garmin_deregistration(self):
|
||||||
data = {"userAccessToken":"dfdzf"}
|
data = {"deregistrations":[{"userAccessToken":"dfdzf"}]}
|
||||||
response = self.c.post('/rowers/garmin/deregistration/',json.dumps(data),
|
response = self.c.post('/rowers/garmin/deregistration/',json.dumps(data),
|
||||||
content_type='application/json')
|
content_type='application/json')
|
||||||
|
|
||||||
|
|||||||
@@ -4721,7 +4721,6 @@ def history_view(request,userid=0):
|
|||||||
|
|
||||||
totalmeters,totalhours, totalminutes, totalseconds = get_totals(g_workouts)
|
totalmeters,totalhours, totalminutes, totalseconds = get_totals(g_workouts)
|
||||||
|
|
||||||
|
|
||||||
# meters, duration per workout type
|
# meters, duration per workout type
|
||||||
wtypes = list(set([w.workouttype for w in g_workouts]))
|
wtypes = list(set([w.workouttype for w in g_workouts]))
|
||||||
|
|
||||||
@@ -4860,14 +4859,13 @@ def history_view_data(request,userid=0):
|
|||||||
|
|
||||||
df = getsmallrowdata_db(columns,ids=ids)
|
df = getsmallrowdata_db(columns,ids=ids)
|
||||||
try:
|
try:
|
||||||
df['deltat'] = df['time'].diff()
|
df['deltat'] = df['time'].diff().clip(lower=0)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
df = dataprep.clean_df_stats(df,workstrokesonly=True,
|
df = dataprep.clean_df_stats(df,workstrokesonly=True,
|
||||||
ignoreadvanced=True,ignorehr=False)
|
ignoreadvanced=True,ignorehr=False)
|
||||||
|
|
||||||
totalmeters,totalhours, totalminutes,totalseconds = get_totals(g_workouts)
|
totalmeters,totalhours, totalminutes,totalseconds = get_totals(g_workouts)
|
||||||
|
|
||||||
# meters, duration per workout type
|
# meters, duration per workout type
|
||||||
wtypes = list(set([w.workouttype for w in g_workouts]))
|
wtypes = list(set([w.workouttype for w in g_workouts]))
|
||||||
|
|
||||||
@@ -4895,7 +4893,7 @@ def history_view_data(request,userid=0):
|
|||||||
)
|
)
|
||||||
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
||||||
try:
|
try:
|
||||||
ddf['deltat'] = ddf['time'].diff()
|
ddf['deltat'] = ddf['time'].diff().clip(lower=0)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
||||||
@@ -4944,7 +4942,7 @@ def history_view_data(request,userid=0):
|
|||||||
totalseconds = 3600*hours+60*minutes+seconds
|
totalseconds = 3600*hours+60*minutes+seconds
|
||||||
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
ddf = getsmallrowdata_db(columns,ids=[w.id for w in a_workouts])
|
||||||
try:
|
try:
|
||||||
ddf['deltat'] = ddf['time'].diff()
|
ddf['deltat'] = ddf['time'].diff().clip(lower=0)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
ddf = dataprep.clean_df_stats(ddf,workstrokesonly=True,
|
||||||
|
|||||||
@@ -1036,26 +1036,19 @@ def garmin_deregistration_view(request):
|
|||||||
if request.method != 'POST':
|
if request.method != 'POST':
|
||||||
return HttpResponse(status=200)
|
return HttpResponse(status=200)
|
||||||
|
|
||||||
t = time.localtime()
|
|
||||||
timestamp = time.strftime('%b-%d-%Y_%H%M', t)
|
|
||||||
with open('garminlog.log','a') as f:
|
|
||||||
f.write('\n')
|
|
||||||
f.write(timestamp)
|
|
||||||
f.write(' ')
|
|
||||||
f.write(str(request.body))
|
|
||||||
|
|
||||||
data = json.loads(request.body)
|
data = json.loads(request.body)
|
||||||
|
deregistrations = data['deregistrations']
|
||||||
|
for deregistration in deregistrations:
|
||||||
try:
|
try:
|
||||||
garmintoken = data['userAccessToken']
|
garmintoken = deregistration['userAccessToken']
|
||||||
except KeyError:
|
|
||||||
print(data)
|
|
||||||
return HttpResponse(status=200)
|
|
||||||
try:
|
try:
|
||||||
r = Rower.objects.get(garmintoken=garmintoken)
|
r = Rower.objects.get(garmintoken=garmintoken)
|
||||||
r.garmintoken = ''
|
r.garmintoken = ''
|
||||||
r.save()
|
r.save()
|
||||||
except Rower.DoesNotExist:
|
except Rower.DoesNotExist:
|
||||||
return HttpResponse(status=200)
|
pass
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
return HttpResponse(status=200)
|
return HttpResponse(status=200)
|
||||||
|
|
||||||
|
|||||||
@@ -1967,7 +1967,11 @@ def plannedsession_view(request,id=0,userid=0):
|
|||||||
microsecs = 0
|
microsecs = 0
|
||||||
|
|
||||||
# taking workout duration plus 1 minute penalty
|
# taking workout duration plus 1 minute penalty
|
||||||
wdict['time'] = w.duration
|
wdict['time'] = datetime.timedelta(
|
||||||
|
hours=w.duration.hour,
|
||||||
|
minutes=w.duration.minute,
|
||||||
|
seconds=w.duration.second,
|
||||||
|
)
|
||||||
wdict['distance'] = ps.course.distance
|
wdict['distance'] = ps.course.distance
|
||||||
wdict['coursecompleted'] = False
|
wdict['coursecompleted'] = False
|
||||||
|
|
||||||
|
|||||||
@@ -1631,7 +1631,7 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
raise Http404("Virtual Challenge does not exist")
|
raise Http404("Virtual Challenge does not exist")
|
||||||
|
|
||||||
categories = None
|
categories = None
|
||||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,None,race)
|
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,referencespeed,initialcategory = default_class(r,None,race)
|
||||||
if race.coursestandards is not None:
|
if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
standardcollection=race.coursestandards).order_by("name")
|
||||||
@@ -1918,7 +1918,7 @@ def virtualevent_register_view(request,id=0):
|
|||||||
raise Http404("Virtual Challenge does not exist")
|
raise Http404("Virtual Challenge does not exist")
|
||||||
|
|
||||||
categories = None
|
categories = None
|
||||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,None,race)
|
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,referencespeed,initialcategory = default_class(r,None,race)
|
||||||
if race.coursestandards is not None:
|
if race.coursestandards is not None:
|
||||||
categories = CourseStandard.objects.filter(
|
categories = CourseStandard.objects.filter(
|
||||||
standardcollection=race.coursestandards).order_by("name")
|
standardcollection=race.coursestandards).order_by("name")
|
||||||
@@ -2943,7 +2943,7 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if records.count() == 0:
|
if records.count() == 0:
|
||||||
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,None,race)
|
hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,referencespeed,initialcategory = default_class(r,None,race)
|
||||||
if not hasinitial:
|
if not hasinitial:
|
||||||
messages.error(request,"Sorry, you have to register first")
|
messages.error(request,"Sorry, you have to register first")
|
||||||
url = reverse('virtualevent_view',
|
url = reverse('virtualevent_view',
|
||||||
@@ -2961,6 +2961,7 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0):
|
|||||||
sex=sex,
|
sex=sex,
|
||||||
age=calculate_age(r.birthdate),
|
age=calculate_age(r.birthdate),
|
||||||
entrycategory=initialcategory,
|
entrycategory=initialcategory,
|
||||||
|
referencespeed=referencespeed,
|
||||||
)
|
)
|
||||||
record.save()
|
record.save()
|
||||||
records = [record]
|
records = [record]
|
||||||
@@ -3277,6 +3278,7 @@ def virtualevent_entry_edit_view(request,id=0,entryid=0):
|
|||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
cd = form.cleaned_data
|
cd = form.cleaned_data
|
||||||
|
|
||||||
|
|
||||||
teamname = cd['teamname']
|
teamname = cd['teamname']
|
||||||
try:
|
try:
|
||||||
boattype = cd['boattype']
|
boattype = cd['boattype']
|
||||||
@@ -3293,12 +3295,12 @@ def virtualevent_entry_edit_view(request,id=0,entryid=0):
|
|||||||
acceptsocialmedia = cd['acceptsocialmedia']
|
acceptsocialmedia = cd['acceptsocialmedia']
|
||||||
|
|
||||||
sex = r.sex
|
sex = r.sex
|
||||||
|
|
||||||
if mix:
|
if mix:
|
||||||
sex = 'mixed'
|
sex = 'mixed'
|
||||||
|
|
||||||
if boattype == '1x' and r.birthdate:
|
if boattype == '1x' and r.birthdate:
|
||||||
age = calculate_age(r.birthdate)
|
age = calculate_age(r.birthdate)
|
||||||
sex = r.sex
|
|
||||||
|
|
||||||
if sex == 'not specified':
|
if sex == 'not specified':
|
||||||
sex = 'male'
|
sex = 'male'
|
||||||
@@ -3328,6 +3330,7 @@ def virtualevent_entry_edit_view(request,id=0,entryid=0):
|
|||||||
messages.error(request,'You are older than the maximum age for this group')
|
messages.error(request,'You are older than the maximum age for this group')
|
||||||
return HttpResponseRedirect(returnurl)
|
return HttpResponseRedirect(returnurl)
|
||||||
|
|
||||||
|
print(sex,coursestandard.sex)
|
||||||
if sex == 'male' and coursestandard.sex != 'male':
|
if sex == 'male' and coursestandard.sex != 'male':
|
||||||
messages.error(request,'Men are not allowed to enter this category')
|
messages.error(request,'Men are not allowed to enter this category')
|
||||||
return HttpResponseRedirect(returnurl)
|
return HttpResponseRedirect(returnurl)
|
||||||
|
|||||||
Reference in New Issue
Block a user