diff --git a/rowers/forms.py b/rowers/forms.py index 98971e53..d0e78a23 100644 --- a/rowers/forms.py +++ b/rowers/forms.py @@ -373,7 +373,7 @@ class UploadOptionsForm(forms.Form): label='Make Workout Private') submitrace = forms.ModelChoiceField(queryset=VirtualRace.objects.all(), - label='Submit as Race Result', + label='Submit as challenge Result', required=False) landingpage = forms.ChoiceField(choices=nextpages, @@ -1382,11 +1382,11 @@ def get_countries(): class VirtualRaceSelectForm(forms.Form): regattatypechoices = ( - ('upcoming','Upcoming Races'), - ('ongoing','Ongoing Races'), - ('previous','Previous Races'), - ('my','My Races'), - ('all','All Races'), + ('upcoming','Upcoming Challenges'), + ('ongoing','Ongoing Challenges'), + ('previous','Previous Challenges'), + ('my','My Challenges'), + ('all','All Challenges'), ) regattatype = forms.ChoiceField( diff --git a/rowers/models.py b/rowers/models.py index f9f2b531..3d62dc69 100644 --- a/rowers/models.py +++ b/rowers/models.py @@ -2032,8 +2032,8 @@ class PlannedSession(models.Model): ('test','Mandatory Test'), ('cycletarget','Total for a time period'), ('coursetest','OTW test over a course'), - ('race','Virtual Race'), - ('indoorrace','Indoor Virtual Race'), + ('race','Virtual challenge'), + ('indoorrace','Indoor Virtual challenge'), ) regularsessiontypechoices = ( @@ -2197,8 +2197,8 @@ from django.core.validators import RegexValidator,validate_email registerchoices = ( - ('windowstart','Start of Race Window'), - ('windowend','End of Race Window'), + ('windowstart','Start of challenge Window'), + ('windowend','End of challenge Window'), ('deadline','Evaluation Closure Deadline'), ('manual','Manual - select below'), ) @@ -2239,7 +2239,7 @@ class VirtualRace(PlannedSession): startdate = self.startdate enddate = self.enddate - stri = u'Virtual Race {n}'.format( + stri = u'Virtual challenge {n}'.format( n = name, ) @@ -2505,11 +2505,11 @@ class IndoorVirtualRaceForm(ModelForm): if startdatetime > enddatetime: - raise forms.ValidationError("The Start of the Race Window should be before the End of the Race Window") + raise forms.ValidationError("The Start of the challenge Window should be before the End of the challenge Window") if cd['evaluation_closure'] <= enddatetime: - raise forms.ValidationError("Evaluation closure deadline should be after the Race Window closes") + raise forms.ValidationError("Evaluation closure deadline should be after the challenge Window closes") if cd['evaluation_closure'] <= timezone.now(): raise forms.ValidationError("Evaluation closure cannot be in the past") @@ -2626,11 +2626,11 @@ class VirtualRaceForm(ModelForm): if startdatetime > enddatetime: - raise forms.ValidationError("The Start of the Race Window should be before the End of the Race Window") + raise forms.ValidationError("The Start of the challenge Window should be before the End of the challenge Window") if cd['evaluation_closure'] <= enddatetime: - raise forms.ValidationError("Evaluation closure deadline should be after the Race Window closes") + raise forms.ValidationError("Evaluation closure deadline should be after the challenge Window closes") if cd['evaluation_closure'] <= timezone.now(): raise forms.ValidationError("Evaluation closure cannot be in the past") @@ -2924,7 +2924,7 @@ class VirtualRaceResult(models.Model): age = models.IntegerField(null=True) emailnotifications = models.BooleanField(default=True, - verbose_name = 'Receive race notifications by email') + verbose_name = 'Receive challenge notifications by email') def __str__(self): rr = Rower.objects.get(id=self.userid) @@ -2980,7 +2980,7 @@ class IndoorVirtualRaceResult(models.Model): age = models.IntegerField(null=True) emailnotifications = models.BooleanField(default=True, - verbose_name = 'Receive race notifications by email') + verbose_name = 'Receive challenge notifications by email') def __str__(self): rr = Rower.objects.get(id=self.userid) diff --git a/rowers/tasks.py b/rowers/tasks.py index d85afb51..b78a81bc 100644 --- a/rowers/tasks.py +++ b/rowers/tasks.py @@ -11,6 +11,7 @@ import gzip import shutil import numpy as np import re +import sys from scipy import optimize from scipy.signal import savgol_filter @@ -188,6 +189,15 @@ def handle_strava_sync(stravatoken,workoutid,filename,name,activity_type,descrip except TypeError: act = client.update_activity(res.id,activity_type=activity_type, description=description) + except: + e = sys.exc_info()[0] + t = time.localtime() + timestamp = time.strftime('%b-%d-%Y_%H%M', t) + with open('stravalog.log','a') as f: + f.write('\n') + f.write(timestamp) + f.write(str(e)) + result = update_workout_field_sql(workoutid,'uploadedtostrava',res.id,debug=debug) try: os.remove(filename) @@ -750,6 +760,24 @@ def handle_calctrimp(id, if np.isnan(hrtss): hrtss = 0 + if tss > 1000: + tss = 0 + + if trimp > 1000: + trimp = 0 + + if normp > 2000: + normp = 0 + + if normv > 2000: + normv = 0 + + if normw > 10000: + normw = 0 + + if hrtss > 1000: + hrtss = 0 + query = 'UPDATE rowers_workout SET rscore = {tss}, normp = {normp}, trimp={trimp}, hrtss={hrtss}, normv={normv}, normw={normw} WHERE id={id}'.format( tss = int(tss), diff --git a/rowers/templates/indoorvirtualeventcreate.html b/rowers/templates/indoorvirtualeventcreate.html index 63095c09..2fcc477b 100644 --- a/rowers/templates/indoorvirtualeventcreate.html +++ b/rowers/templates/indoorvirtualeventcreate.html @@ -2,19 +2,19 @@ {% load staticfiles %} {% load rowerfilters %} -{% block title %}New Virtual Race{% endblock %} +{% block title %}New Virtual Challenge{% endblock %} {% block main %} -
With this form, you can create a new virtual race. After you submit - the form, the race is created and will be visible to all users. From - that moment, only the site admin can delete the race - (admin@rowsandall.com). You can still edit the race until - the start of the race window. +
With this form, you can create a new virtual challenge. After you submit + the form, the challenge is created and will be visible to all users. From + that moment, only the site admin can delete the challenge + (admin@rowsandall.com). You can still edit the challenge until + the start of the challenge window.
If your event has a registration closure deadline, participants have to enter (and can withdraw) before the registration closure time.
Participants can submit results until the evaluation closure time.
-Until one hour after evaluation closure time, the race organizer +
Until one hour after evaluation closure time, the challenge organizer can review and reject submitted results ("disqualification"). If - you as the race organizer intend to use this functionality, it + you as the challenge organizer intend to use this functionality, it is strongly recommended that you fill out a contact email or phone number.
diff --git a/rowers/templates/menu_racing.html b/rowers/templates/menu_racing.html index c66bcd7f..058a8cab 100644 --- a/rowers/templates/menu_racing.html +++ b/rowers/templates/menu_racing.html @@ -2,17 +2,17 @@