bug fix and fairer GPS comparisons
This commit is contained in:
@@ -261,6 +261,18 @@ def pretty_timedelta(secs):
|
|||||||
|
|
||||||
return '{}:{:02}:{:02}'.format(int(hours),int(minutes),int(seconds))
|
return '{}:{:02}:{:02}'.format(int(hours),int(minutes),int(seconds))
|
||||||
|
|
||||||
|
def mapcolors(x):
|
||||||
|
try:
|
||||||
|
return mytypes.color_map[x]
|
||||||
|
except KeyError:
|
||||||
|
return mytypes.colors[-1]
|
||||||
|
|
||||||
|
def maptypes(x):
|
||||||
|
try:
|
||||||
|
return mytypes.workouttypes_ordered[x]
|
||||||
|
except KeyError:
|
||||||
|
return 'Other'
|
||||||
|
|
||||||
def interactive_workouttype_piechart(workouts):
|
def interactive_workouttype_piechart(workouts):
|
||||||
if len(workouts) == 0:
|
if len(workouts) == 0:
|
||||||
return "","Not enough workouts to make a chart"
|
return "","Not enough workouts to make a chart"
|
||||||
@@ -286,7 +298,7 @@ def interactive_workouttype_piechart(workouts):
|
|||||||
|
|
||||||
|
|
||||||
data = pd.DataFrame(data)
|
data = pd.DataFrame(data)
|
||||||
data['color'] = data['type'].apply(lambda x:mytypes.color_map[x])
|
data['color'] = data['type'].apply(lambda x:mapcolors(x))
|
||||||
data['totaltime'] = data['value'].apply(lambda x:pretty_timedelta(x))
|
data['totaltime'] = data['value'].apply(lambda x:pretty_timedelta(x))
|
||||||
data['type'] = data['type'].apply(lambda x:mytypes.workouttypes_ordered[x])
|
data['type'] = data['type'].apply(lambda x:mytypes.workouttypes_ordered[x])
|
||||||
|
|
||||||
|
|||||||
@@ -273,7 +273,8 @@ checktypes = [i[0] for i in workouttypes]
|
|||||||
from bokeh.palettes import Category10,Category20, Category20c
|
from bokeh.palettes import Category10,Category20, Category20c
|
||||||
|
|
||||||
|
|
||||||
colors = Category10[9]+Category20[19]+Category20c[19]
|
#colors = Category10[9]
|
||||||
|
colors = Category10[9]+list(set(Category20[19]+Category20c[19]))
|
||||||
color_map = {checktypes[i]:colors[i] for i in range(len(checktypes))}
|
color_map = {checktypes[i]:colors[i] for i in range(len(checktypes))}
|
||||||
|
|
||||||
workoutsources = (
|
workoutsources = (
|
||||||
|
|||||||
@@ -1640,18 +1640,22 @@ def virtualevent_addboat_view(request,id=0):
|
|||||||
race = race).exclude(userid = r.id)
|
race = race).exclude(userid = r.id)
|
||||||
|
|
||||||
for otherrecord in otherrecords:
|
for otherrecord in otherrecords:
|
||||||
otheruser = Rower.objects.get(id=otherrecord.userid)
|
try:
|
||||||
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||||
registeredname = r.user.first_name+' '+r.user.last_name
|
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||||
if otherrecord.emailnotifications:
|
registeredname = r.user.first_name+' '+r.user.last_name
|
||||||
job = myqueue(
|
if otherrecord.emailnotifications:
|
||||||
queue,
|
job = myqueue(
|
||||||
handle_sendemail_raceregistration,
|
queue,
|
||||||
otheruser.user.email, othername,
|
handle_sendemail_raceregistration,
|
||||||
registeredname,
|
otheruser.user.email, othername,
|
||||||
race.name,
|
registeredname,
|
||||||
race.id
|
race.name,
|
||||||
)
|
race.id
|
||||||
|
)
|
||||||
|
except Rower.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
followers = VirtualRaceFollower.objects.filter(race = race)
|
followers = VirtualRaceFollower.objects.filter(race = race)
|
||||||
|
|
||||||
@@ -1868,18 +1872,21 @@ def virtualevent_register_view(request,id=0):
|
|||||||
race = race).exclude(userid = r.id)
|
race = race).exclude(userid = r.id)
|
||||||
|
|
||||||
for otherrecord in otherrecords:
|
for otherrecord in otherrecords:
|
||||||
otheruser = Rower.objects.get(id=otherrecord.userid)
|
try:
|
||||||
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||||
registeredname = r.user.first_name+' '+r.user.last_name
|
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||||
if otherrecord.emailnotifications:
|
registeredname = r.user.first_name+' '+r.user.last_name
|
||||||
job = myqueue(
|
if otherrecord.emailnotifications:
|
||||||
queue,
|
job = myqueue(
|
||||||
handle_sendemail_raceregistration,
|
queue,
|
||||||
otheruser.user.email, othername,
|
handle_sendemail_raceregistration,
|
||||||
registeredname,
|
otheruser.user.email, othername,
|
||||||
race.name,
|
registeredname,
|
||||||
race.id
|
race.name,
|
||||||
)
|
race.id
|
||||||
|
)
|
||||||
|
except Rower.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
followers = VirtualRaceFollower.objects.filter(race = race)
|
followers = VirtualRaceFollower.objects.filter(race = race)
|
||||||
|
|
||||||
@@ -2136,18 +2143,21 @@ def indoorvirtualevent_register_view(request,id=0):
|
|||||||
race = race).exclude(userid = r.id)
|
race = race).exclude(userid = r.id)
|
||||||
|
|
||||||
for otherrecord in otherrecords:
|
for otherrecord in otherrecords:
|
||||||
otheruser = Rower.objects.get(id=otherrecord.userid)
|
try:
|
||||||
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||||
registeredname = r.user.first_name+' '+r.user.last_name
|
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||||
if otherrecord.emailnotifications:
|
registeredname = r.user.first_name+' '+r.user.last_name
|
||||||
job = myqueue(
|
if otherrecord.emailnotifications:
|
||||||
queue,
|
job = myqueue(
|
||||||
handle_sendemail_raceregistration,
|
queue,
|
||||||
otheruser.user.email, othername,
|
handle_sendemail_raceregistration,
|
||||||
registeredname,
|
otheruser.user.email, othername,
|
||||||
race.name,
|
registeredname,
|
||||||
race.id
|
race.name,
|
||||||
)
|
race.id
|
||||||
|
)
|
||||||
|
except Rower.DoesNotExist:
|
||||||
|
pass
|
||||||
|
|
||||||
followers = VirtualRaceFollower.objects.filter(race = race)
|
followers = VirtualRaceFollower.objects.filter(race = race)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user