diff --git a/requirements.txt b/requirements.txt
index baaff87b..7ad91305 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,6 +3,7 @@ apipkg==1.5
appdirs==1.4.3
arcgis==1.6.0
arrow==0.13.1
+asgiref==3.2.7
asn1crypto==0.24.0
atomicwrites==1.3.0
attrs==19.1.0
@@ -12,6 +13,8 @@ billiard==3.6.0.0
bleach==3.1.0
bokeh==1.0.4
boto==2.49.0
+boto3==1.14.7
+botocore==1.17.7
braintree==3.55.0
cairocffi==1.0.2
celery==4.3.0
@@ -53,7 +56,7 @@ django-rest-framework==0.1.0
django-rest-swagger==2.2.0
django-rq==1.3.1
django-rq-dashboard==0.3.3
-django-ses==0.8.10
+django-ses==1.0.0
django-shell-plus==1.1.7
django-social-share==1.3.2
django-suit==0.2.26
@@ -96,6 +99,7 @@ itypes==1.1.0
jedi==0.13.3
jeepney==0.4
Jinja2==2.10
+jmespath==0.10.0
json5==0.8.5
jsonschema==3.0.1
jupyter==1.0.0
@@ -107,7 +111,7 @@ jupyterlab-server==0.3.0
keyring==18.0.0
kiwisolver==1.0.1
kombu==4.5.0
-llvmlite==0.33.0
+llvmlite==0.30.0
lxml==4.3.2
Markdown==3.0.1
MarkupSafe==1.1.1
@@ -148,7 +152,7 @@ protobuf==3.11.1
psycopg2==2.8.1
ptyprocess==0.6.0
py==1.8.0
-pyarrow==0.17.1
+pyarrow==0.15.0
pycairo==1.19.0
pycparser==2.19
Pygments==2.3.1
@@ -179,6 +183,7 @@ rowingdata==2.9.1
rowingphysics==0.5.0
rq==0.13.0
rules==2.1
+s3transfer==0.3.3
scipy==1.2.1
SecretStorage==3.1.1
Send2Trash==1.5.0
@@ -188,7 +193,7 @@ simplejson==3.16.0
six==1.12.0
soupsieve==1.8
SQLAlchemy==1.3.1
-sqlparse==0.3.0
+sqlparse==0.3.1
stravalib==0.10.2
termcolor==1.1.0
terminado==0.8.1
diff --git a/rowers/courseutils.py b/rowers/courseutils.py
index 6ff83fc7..d864e372 100644
--- a/rowers/courseutils.py
+++ b/rowers/courseutils.py
@@ -2,7 +2,7 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
-
+import time
@@ -19,7 +19,7 @@ class InvalidTrajectoryError(Exception):
def __str__(self):
return repr(self.value)
-def time_in_path(df,p,maxmin='max',getall=False):
+def time_in_path(df,p,maxmin='max',getall=False,name='unknown',logfile=None):
if df.empty:
return 0
@@ -38,25 +38,64 @@ def time_in_path(df,p,maxmin='max',getall=False):
if len(df[b==2]):
+ if logfile is not None:
+ t = time.localtime()
+ timestamp = time.strftime('%b-%d-%Y_%H%M', t)
+ with open(logfile,'a') as f:
+ f.write('\n')
+ f.write(timestamp)
+ f.write(' ')
+ f.write(name)
+ f.write(' ')
+ f.write(maxmin)
+ f.write(' ')
+ f.write(str(getall))
+ f.write(' ')
+ f.write(str(len(df[b==2])))
+ f.write(' ')
+ if len(df[b==2])>1:
+ f.write(' passes found')
+ else:
+ f.write(' pass found')
if getall:
return df[b==2]['time'],df[b==2]['cum_dist']
else:
return df[b==2]['time'].min(),df[b==2]['cum_dist'].min()
+ if logfile is not None:
+ t = time.localtime()
+ timestamp = time.strftime('%b-%d-%Y_%H%M', t)
+ with open(logfile,'a') as f:
+ f.write('\n')
+ f.write(timestamp)
+ f.write(' ')
+ f.write(name)
+ f.write(' ')
+ f.write(maxmin)
+ f.write(' ')
+ f.write(str(getall))
+ f.write(' ')
+ f.write(str(len(df[b==2])))
+ f.write(' ')
+ f.write(' pass not found')
raise InvalidTrajectoryError("Trajectory doesn't go through path")
return 0
-def coursetime_first(data,paths):
+def coursetime_first(data,paths,polygons=[],logfile=None):
entrytime = data['time'].max()
entrydistance = data['cum_dist'].max()
coursecompleted = False
+ if len(polygons) == 0:
+ polygons = [(0,str(i)) for i in range(len(paths))]
+
+
try:
- entrytime,entrydistance = time_in_path(data,paths[0],maxmin='max')
+ entrytime,entrydistance = time_in_path(data,paths[0],maxmin='max',name=polygons[0][1],logfile=logfile)
coursecompleted = True
except InvalidTrajectoryError:
entrytime = data['time'].max()
@@ -64,12 +103,15 @@ def coursetime_first(data,paths):
coursecompleted = False
return entrytime, entrydistance, coursecompleted
-def coursetime_paths(data,paths,finalmaxmin='min'):
+def coursetime_paths(data,paths,finalmaxmin='min',polygons=[],logfile=None):
entrytime = data['time'].max()
entrydistance = data['cum_dist'].max()
coursecompleted = False
+ if len(polygons) == 0:
+ polygons = [(0,str(i)) for i in range(len(paths))]
+
# corner case - empty list of paths
if len(paths) == 0:
return 0,True
@@ -80,7 +122,7 @@ def coursetime_paths(data,paths,finalmaxmin='min'):
(
entrytime,
entrydistance
- ) = time_in_path(data,paths[0],maxmin=finalmaxmin)
+ ) = time_in_path(data,paths[0],maxmin=finalmaxmin,name = polygons[0][1],logfile=logfile)
coursecompleted = True
except InvalidTrajectoryError:
entrytime = data['time'].max()
@@ -90,7 +132,7 @@ def coursetime_paths(data,paths,finalmaxmin='min'):
if len(paths) > 1:
try:
- time,dist = time_in_path(data, paths[0])
+ time,dist = time_in_path(data, paths[0],name=polygons[0][1],logfile=logfile)
data = data[data['time']>time]
data['time'] = data['time']-time
data['cum_dist'] = data['cum_dist']-dist
@@ -98,7 +140,7 @@ def coursetime_paths(data,paths,finalmaxmin='min'):
timenext,
distnext,
coursecompleted
- ) = coursetime_paths(data,paths[1:])
+ ) = coursetime_paths(data,paths[1:],polygons=polygons[1:],logfile=logfile)
return time+timenext, dist+distnext,coursecompleted
except InvalidTrajectoryError:
entrytime = data['time'].max()
diff --git a/rowers/emails.py b/rowers/emails.py
index b232ee09..59f3e0ec 100644
--- a/rowers/emails.py
+++ b/rowers/emails.py
@@ -53,7 +53,7 @@ from django.contrib.staticfiles import finders
def textify(html):
- # Remove html tags and continuous whitespaces
+ # Remove html tags and continuous whitespaces
text_only = re.sub('[ \t]+', ' ', strip_tags(html))
# Strip single spaces in the beginning of each line
return text_only.replace('\n ', '\n').strip()
@@ -61,7 +61,7 @@ def textify(html):
def htmlstripnobr(html):
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
return safe_html
-
+
def htmlstrip(html):
safe_html = re.sub('[ \t]+', ' ', strip_tags(html))
return newlinetobr(safe_html)
@@ -80,11 +80,17 @@ def send_template_email(from_email,to_email,subject,
text_content = textify(html_content)
# html_content = newlinetobr(html_content)
- if 'cc' in kwargs:
+
+ if 'bcc' in kwargs and 'cc' in kwargs:
+ msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,cc=kwargs['cc'],
+ bcc=kwargs['bcc'])
+ elif 'bcc' in kwargs:
+ msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,bcc=kwargs['bcc'])
+ elif 'cc' in kwargs:
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email,cc=kwargs['cc'])
else:
msg = EmailMultiAlternatives(subject, text_content, from_email, to_email)
-
+
msg.attach_alternative(html_content, "text/html")
if 'attach_file' in kwargs:
@@ -106,8 +112,8 @@ def send_template_email(from_email,to_email,subject,
else:
emailbounced = False
-
-
+
+
if not emailbounced:
res = msg.send()
else:
diff --git a/rowers/forms.py b/rowers/forms.py
index 3dc3a222..d3b23329 100644
--- a/rowers/forms.py
+++ b/rowers/forms.py
@@ -124,7 +124,7 @@ class EmailForm(forms.Form):
subject = forms.CharField(max_length=255)
message = forms.CharField(widget=forms.Textarea())
-
+
disqualificationreasons = (
('noimage','No monitor screenshot or data evidence was included'),
@@ -386,7 +386,7 @@ class UploadOptionsForm(forms.Form):
makeprivate = forms.BooleanField(initial=False,required=False,
label='Make Workout Private')
- submitrace = forms.ModelChoiceField(queryset=VirtualRace.objects.all(),
+ submitrace = forms.ChoiceField(
label='Submit as challenge Result',
required=False)
@@ -404,6 +404,7 @@ class UploadOptionsForm(forms.Form):
r = Rower.objects.get(user=self.request.user)
races = VirtualRace.objects.filter(
registration_closure__gt=timezone.now())
+
registrations = IndoorVirtualRaceResult.objects.filter(
race__in = races,
userid = r.id)
@@ -413,25 +414,41 @@ class UploadOptionsForm(forms.Form):
userid = r.id,
)
- raceids = [r.race.id for r in registrations]
- raceids2 = [r.race.id for r in registrations2]
+ choices1 = [(r.id,str(r)) for r in registrations]
+ choices2 = [(r.id,str(r)) for r in registrations2]
+ choices3 = [(0,'---')]
- raceids = raceids+raceids2
+ noregistrations = []
+ for ra in VirtualRace.objects.filter(registration_closure__gt=timezone.now(),sessiontype='race'):
+ rs = VirtualRaceResult.objects.filter(race = ra,userid=r.id)
+ if rs.count()==0:
+ noregistrations.append((-ra.id,ra.name))
+ for ra in VirtualRace.objects.filter(registration_closure__gt=timezone.now(),sessiontype='indoorrace'):
+ rs = IndoorVirtualRaceResult.objects.filter(race = ra,userid=r.id)
+ if rs.count()==0:
+ noregistrations.append((-ra.id,ra.name))
- races = VirtualRace.objects.filter(
- id__in=raceids
- )
+ choices = choices3+choices1+choices2+noregistrations
+ if int(raceid) in [r.id for r in races]:
+ therace = VirtualRace.objects.get(id=raceid)
+ if therace.sessiontype == 'race':
+ registrations = VirtualRaceResult.objects.filter(race=therace,userid=r.id)
+ else:
+ registrations = IndoorVirtualRaceResult.objects.filter(race=therace,userid=r.id)
+
+ if registrations.count()==0:
+ race = VirtualRace.objects.get(id=raceid)
+ choices = [(-int(raceid),race.name)]
+ else:
+ choices = [(r.id,str(r)) for r in registrations]
+ choices = choices+[(0,'---')]
if races:
- self.fields['submitrace'].queryset = races
+ self.fields['submitrace'].choices = choices
else:
del self.fields['submitrace']
- if int(raceid) in raceids:
- self.fields['submitrace'].initial = VirtualRace.objects.get(id=raceid)
-
-
# The form to indicate additional actions to be performed immediately
# after a successful upload. This version allows the Team manager to select
diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py
index be7360b5..6ad25d6a 100644
--- a/rowers/interactiveplots.py
+++ b/rowers/interactiveplots.py
@@ -5481,8 +5481,11 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line',
else:
windowsize = 1
- if windowsize >= 3 and windowsize < len(group['y']):
- group['y'] = savgol_filter(group['y'],windowsize,3)
+ if windowsize > 3 and windowsize < len(group['y']):
+ try:
+ group['y'] = savgol_filter(group['y'],windowsize,3)
+ except ValueError:
+ pass
ylabel = Label(x=100,y=60+nrworkouts*20-20*cntr,
x_units='screen',y_units='screen',
diff --git a/rowers/models.py b/rowers/models.py
index e28fef26..8e9ed3f8 100644
--- a/rowers/models.py
+++ b/rowers/models.py
@@ -2643,7 +2643,11 @@ class VirtualRaceForm(ModelForm):
enddatetime
)
- registration_closure = cd['registration_closure']
+ try:
+ registration_closure = cd['registration_closure']
+ except KeyError:
+ registration_closure = enddatetime+datetime.timedelta(days=1)
+ cd['registration_closure'] = registration_closure
registration_form = cd['registration_form']
@@ -3120,6 +3124,8 @@ class CourseTestResult(models.Model):
distance = models.IntegerField(default=0)
coursecompleted = models.BooleanField(default=False)
+
+
class IndoorVirtualRaceResultForm(ModelForm):
class Meta:
model = IndoorVirtualRaceResult
diff --git a/rowers/plannedsessions.py b/rowers/plannedsessions.py
index d8936ca3..7f4d23c0 100644
--- a/rowers/plannedsessions.py
+++ b/rowers/plannedsessions.py
@@ -45,7 +45,7 @@ from rowers.models import (
GeoCourse, TrainingMicroCycle,TrainingMesoCycle,TrainingMacroCycle,
TrainingPlan,PlannedSession,VirtualRaceResult,CourseTestResult,
get_course_timezone, IndoorVirtualRaceResult,VirtualRace,createmacrofillers,
- createmesofillers,createmicrofillers,
+ createmesofillers,createmicrofillers,CourseStandard,
)
from rowers.courses import get_time_course
@@ -1026,7 +1026,13 @@ def race_can_edit(r,race):
startdatetime = pytz.timezone(race.timezone).localize(
startdatetime
)
- if timezone.now()
+ The attachment contains debugging information for the site owners. +
+Best Regards, the Rowsandall Team
diff --git a/rowers/templates/virtualevent.html b/rowers/templates/virtualevent.html index 26d16084..6decfc0c 100644 --- a/rowers/templates/virtualevent.html +++ b/rowers/templates/virtualevent.html @@ -163,6 +163,7 @@ Registered users of rowsandall.com can participate in this challenge. Participation is free, unless specified differently in the race comment above. {% if race.sessiontype == 'race' %} + Register to let others know you plan to do this challenge:
+ Register to let others know you plan to do this challenge. This also give you the option to
+ select your entry category:
{% if race.sessiontype == 'race' %}
Register
{% else %}
diff --git a/rowers/views/analysisviews.py b/rowers/views/analysisviews.py
index a8c58849..b02a7cb9 100644
--- a/rowers/views/analysisviews.py
+++ b/rowers/views/analysisviews.py
@@ -526,6 +526,11 @@ def statsdata(workouts, options):
datadf = dataprep.clean_df_stats(datadf,workstrokesonly=workstrokesonly)
+ try:
+ datadf['pace'] = datadf['pace']/1000.
+ except KeyError:
+ pass
+
# Create stats
stats = {}
# fielddict.pop('workoutstate')
@@ -4169,6 +4174,10 @@ def cumstats(request,userid=0,
datadf,extracols = dataprep.read_cols_df_sql(ids,fieldlist)
datadf = dataprep.clean_df_stats(datadf,workstrokesonly=workstrokesonly)
+ try:
+ datadf['pace'] = datadf['pace']/1000.
+ except KeyError:
+ pass
request.session['rowerid'] = r.id
diff --git a/rowers/views/planviews.py b/rowers/views/planviews.py
index f30b51b9..7db2babe 100644
--- a/rowers/views/planviews.py
+++ b/rowers/views/planviews.py
@@ -81,7 +81,10 @@ def plannedsession_comment_view(request,id=0,userid=0):
rowers = {r.user for r in ps.rower.all()}
commenters = set(list(commenters)+list(rowers))
for u in commenters:
- a_messages.info(u,message)
+ try:
+ a_messages.info(u,message)
+ except ValueError:
+ pass
if u != request.user and u != r.user:
ocr = Rower.objects.get(user=u)
res = myqueue(queuelow,
diff --git a/rowers/views/racesviews.py b/rowers/views/racesviews.py
index 81d1ab5e..93df6047 100644
--- a/rowers/views/racesviews.py
+++ b/rowers/views/racesviews.py
@@ -746,6 +746,7 @@ def virtualevent_disqualify_view(request,id=0,recordid=0):
r = getrower(request.user)
race = get_object_or_404(VirtualRace,pk=id)
+ raceid = race.id
if race.sessiontype == 'race':
@@ -1223,7 +1224,6 @@ def virtualevent_view(request,id=0):
comments = PlannedSessionComment.objects.filter(plannedsession=race).order_by("created")
-
return render(request,'virtualevent.html',
{
'coursescript':script,
@@ -1500,6 +1500,7 @@ def virtualevent_addboat_view(request,id=0):
raise Http404("Virtual Challenge does not exist")
categories = None
+ hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,None,race)
if race.coursestandards is not None:
categories = CourseStandard.objects.filter(
standardcollection=race.coursestandards).order_by("name")
@@ -1701,11 +1702,22 @@ def virtualevent_addboat_view(request,id=0):
return HttpResponseRedirect(url)
else:
- initial = {
- 'age': calculate_age(r.birthdate),
- 'weightcategory': r.weightcategory,
- 'adaptiveclass': r.adaptiveclass,
+ if hasinitial:
+ initial = {
+ 'age': calculate_age(r.birthdate),
+ 'boattype':boattype,
+ 'boatclass':boatclass,
+ 'adaptiveclass':adaptiveclass,
+ 'weightclass':weightclass,
+ 'sex':sex,
+ 'entrycategory':initialcategory,
}
+ else:
+ initial = {
+ 'age': calculate_age(r.birthdate),
+ 'weightcategory': r.weightcategory,
+ 'adaptiveclass': r.adaptiveclass,
+ }
categories = None
if race.coursestandards is not None:
@@ -1775,6 +1787,7 @@ def virtualevent_register_view(request,id=0):
raise Http404("Virtual Challenge does not exist")
categories = None
+ hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,None,race)
if race.coursestandards is not None:
categories = CourseStandard.objects.filter(
standardcollection=race.coursestandards).order_by("name")
@@ -1938,11 +1951,22 @@ def virtualevent_register_view(request,id=0):
return HttpResponseRedirect(url)
else:
- initial = {
- 'age': calculate_age(r.birthdate),
- 'weightcategory': r.weightcategory,
- 'adaptiveclass': r.adaptiveclass,
+ if hasinitial:
+ initial = {
+ 'age': calculate_age(r.birthdate),
+ 'boattype':boattype,
+ 'boatclass':boatclass,
+ 'adaptiveclass':adaptiveclass,
+ 'weightclass':weightclass,
+ 'sex':sex,
+ 'entrycategory':initialcategory,
}
+ else:
+ initial = {
+ 'age': calculate_age(r.birthdate),
+ 'weightcategory': r.weightcategory,
+ 'adaptiveclass': r.adaptiveclass,
+ }
categories = None
if race.coursestandards is not None:
@@ -2565,8 +2589,15 @@ def virtualevent_edit_view(request,id=0):
startdatetime
)
- if timezone.now() > startdatetime:
- messages.error(request,"You cannot edit a race after the start of the race window")
+ end_time = race.end_time
+ end_date = race.enddate
+ enddatetime = datetime.datetime.combine(end_date,end_time)
+ enddatetime = pytz.timezone(race.timezone).localize(
+ enddatetime
+ )
+
+ if timezone.now() > enddatetime:
+ messages.error(request,"You cannot edit a race after the end of the race window")
url = reverse('virtualevent_view',
kwargs={
'id':race.id,
@@ -2658,8 +2689,15 @@ def indoorvirtualevent_edit_view(request,id=0):
startdatetime
)
- if timezone.now() > startdatetime:
- messages.error(request,"You cannot edit a race after the start of the race window")
+ end_time = race.end_time
+ end_date = race.enddate
+ enddatetime = datetime.datetime.combine(end_date,end_time)
+ enddatetime = pytz.timezone(race.timezone).localize(
+ enddatetime
+ )
+
+ if timezone.now() > enddatetime:
+ messages.error(request,"You cannot edit a race after the end of the race window")
url = reverse('virtualevent_view',
kwargs={
'id':race.id,
@@ -2773,6 +2811,29 @@ def virtualevent_submit_result_view(request,id=0,workoutid=0):
race=race
)
+ if records.count() == 0:
+ hasinitial,boattype,boatclass,adaptiveclass,weightclass,sex,initialcategory = default_class(r,None,race)
+ if not hasinitial:
+ messages.error(request,"Sorry, you have to register first")
+ url = reverse('virtualevent_view',
+ kwargs = {
+ 'id':id,
+ })
+ return HttpResponseRedirect(url)
+ record = resultobj(
+ userid = r.id,
+ username = r.user.first_name+' '+r.user.last_name,
+ weightcategory=weightclass,
+ adaptiveclass=adaptiveclass,
+ race=race,
+ boatclass=boatclass,
+ sex=sex,
+ age=calculate_age(r.birthdate),
+ entrycategory=initialcategory,
+ )
+ record.save()
+ records = [record]
+
entrychoices = []
diff --git a/rowers/views/workoutviews.py b/rowers/views/workoutviews.py
index 43bea2b4..914064b0 100644
--- a/rowers/views/workoutviews.py
+++ b/rowers/views/workoutviews.py
@@ -4909,7 +4909,7 @@ def workout_upload_view(request,
notes = form.cleaned_data['notes']
offline = form.cleaned_data['offline']
- race = None
+ registrationid = 0
if optionsform.is_valid():
make_plot = optionsform.cleaned_data['make_plot']
plottype = optionsform.cleaned_data['plottype']
@@ -4923,9 +4923,9 @@ def workout_upload_view(request,
landingpage = optionsform.cleaned_data['landingpage']
try:
- race = optionsform.cleaned_data['submitrace']
+ registrationid = optionsform.cleaned_data['submitrace']
except KeyError:
- race = None
+ registrationid = 0
uploadoptions = {
'makeprivate':makeprivate,
@@ -5113,17 +5113,58 @@ def workout_upload_view(request,
else:
messages.error(request,message)
- if race and race_can_submit(r,race):
- if race.sessiontype == 'indoorrace':
- records = IndoorVirtualRaceResult.objects.filter(
- race=race,
- userid=r.id
+ if int(registrationid) < 0:
+ race = VirtualRace.objects.get(id=-int(registrationid))
+ if race.sessiontype == 'race':
+ result,comments,errors,jobid = add_workout_race(
+ [w], race,r,doregister=True,
+ )
+ if result:
+ messages.info(
+ request,
+ "We have submitted your workout to the race")
+
+ for c in comments:
+ messages.info(request,c)
+ for er in errors:
+ messages.error(request,er)
+ elif race.sessiontype == 'indoorrace':
+ result,comments,errors,jobid = add_workout_indoorrace(
+ [w],race,r,doregister=True,
)
- if records:
+ if result:
+ messages.info(
+ request,
+ "We have submitted your workout to the race")
+ for c in comments:
+ messages.info(request,c)
+ for er in errors:
+ messages.error(request,er)
+
+ if int(registrationid)>0:
+ races = VirtualRace.objects.filter(
+ registration_closure__gt=timezone.now()
+ )
+ registrations = IndoorVirtualRaceResult.objects.filter(
+ race__in = races,
+ id=registrationid,
+ userid = r.id,
+ )
+ registrations2 = VirtualRaceResult.objects.filter(
+ race__in = races,
+ id=registrationid,
+ userid=r.id,
+ )
+
+ if int(registrationid) in [r.id for r in registrations]:
+ # indoor race
+ registrations = registrations.filter(id=registrationid)
+ if registrations:
+ race = registrations[0].race
result,comments,errors,jobid = add_workout_indoorrace(
- [w],race,r,recordid=records[0].id
+ [w],race,r,recordid=registrations[0].id
)
if result:
@@ -5135,15 +5176,15 @@ def workout_upload_view(request,
messages.info(request,c)
for er in errors:
messages.error(request,er)
- if race.sessiontype == 'race':
- records = VirtualRaceResult.objects.filter(
- race=race,userid=r.id
- )
- if records:
+ if int(registrationid) in [r.id for r in registrations2]:
+ # race
+ registrations = registrations2.filter(id=registrationid)
+ if registrations:
+ race = registrations[0].race
result,comments,errors,jobid = add_workout_race(
- [w], race,r,recordid=records[0].id
+ [w], race,r,recordid=registrations[0].id
)
if result:
messages.info(
@@ -5156,11 +5197,18 @@ def workout_upload_view(request,
messages.error(request,er)
- if landingpage != 'workout_upload_view':
+
+ if registrationid != 0:
+ url = reverse('virtualevent_view',
+ kwargs = {
+ 'id':race.id,
+ })
+ elif landingpage != 'workout_upload_view':
url = reverse(landingpage,
kwargs = {
'id':encoder.encode_hex(w.id),
})
+
else:
url = reverse(landingpage)
diff --git a/rowsandall_app/settings.py b/rowsandall_app/settings.py
index 04a621a1..aea004aa 100644
--- a/rowsandall_app/settings.py
+++ b/rowsandall_app/settings.py
@@ -379,7 +379,7 @@ CACHE_MIDDLEWARE_SECONDS = 900
EMAIL_BACKEND = 'django_ses.SESBackend'
-AWS_SES_REGION_NAME = CFG['aws_smtp']
+AWS_SES_REGION_NAME = CFG['aws_region']
AWS_SES_REGION_ENDPOINT = CFG['aws_smtp']
AWS_SES_ACCESS_KEY_ID = CFG['aws_access_key_id']