removing mailprocessing file
This commit is contained in:
@@ -1145,10 +1145,10 @@ def update_indoorvirtualrace(ps,cd):
|
||||
|
||||
ps.timezone = timezone_str
|
||||
|
||||
if ps.sessiontype == 'fastest_distance':
|
||||
if ps.sessiontype == 'fastest_distance': # pragma: no cover
|
||||
ps.approximate_distance = ps.sessionvalue
|
||||
|
||||
if ps.course is not None:
|
||||
if ps.course is not None: # pragma: no cover
|
||||
ps.approximate_distance = ps.course.distance
|
||||
|
||||
ps.save()
|
||||
@@ -1204,7 +1204,7 @@ def update_virtualrace(ps,cd):
|
||||
|
||||
ps.timezone = timezone_str
|
||||
|
||||
if ps.sessiontype == 'fastest_distance':
|
||||
if ps.sessiontype == 'fastest_distance': # pragma: no cover
|
||||
ps.approximate_distance = ps.sessionvalue
|
||||
|
||||
if ps.course is not None:
|
||||
@@ -1403,129 +1403,6 @@ def race_can_withdraw(r,race):
|
||||
|
||||
return True
|
||||
|
||||
def email_submit_race(r,race,workoutid):
|
||||
try:
|
||||
w = Workout.objects.get(id=workoutid)
|
||||
except Workout.DoesNotExist: # pragma: no cover
|
||||
return 0
|
||||
|
||||
if race.sessionmode == 'time':
|
||||
wduration = timefield_to_seconds_duration(w.duration)
|
||||
delta = wduration - (60.*race.sessionvalue)
|
||||
|
||||
if delta > -2 and delta < 2:
|
||||
w.duration = totaltime_sec_to_string(60.*race.sessionvalue)
|
||||
w.save()
|
||||
|
||||
|
||||
elif race.sessionmode == 'distance': # pragma: no cover
|
||||
delta = w.distance - race.sessionvalue
|
||||
|
||||
if delta > -5 and delta < 5:
|
||||
w.distance = race.sessionvalue
|
||||
w.save()
|
||||
|
||||
|
||||
if race_can_register(r,race):
|
||||
teamname = ''
|
||||
weightcategory = w.weightcategory
|
||||
sex = r.sex
|
||||
if sex == 'not specified':
|
||||
sex = 'male'
|
||||
|
||||
if not r.birthdate: # pragma: no cover
|
||||
return 0
|
||||
|
||||
age = calculate_age(r.birthdate)
|
||||
|
||||
adaptiveclass = r.adaptiveclass
|
||||
boatclass = w.workouttype
|
||||
|
||||
record = IndoorVirtualRaceResult(
|
||||
userid = r.id,
|
||||
teamname=teamname,
|
||||
race=race,
|
||||
username = u'{f} {l}'.format(
|
||||
f = r.user.first_name,
|
||||
l = r.user.last_name
|
||||
),
|
||||
weightcategory=weightcategory,
|
||||
adaptiveclass=adaptiveclass,
|
||||
duration=dt.time(0,0),
|
||||
boatclass=boatclass,
|
||||
coursecompleted=False,
|
||||
sex=sex,
|
||||
age=age
|
||||
)
|
||||
|
||||
record.save()
|
||||
|
||||
result = add_rower_race(r,race)
|
||||
|
||||
otherrecords = IndoorVirtualRaceResult.objects.filter(
|
||||
race = race)
|
||||
|
||||
|
||||
for otherrecord in otherrecords:
|
||||
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||
registeredname = r.user.first_name+' '+r.user.last_name
|
||||
if otherrecord.emailnotifications:
|
||||
job = myqueue(
|
||||
queue,
|
||||
handle_sendemail_raceregistration,
|
||||
otheruser.user.email, othername,
|
||||
registeredname,
|
||||
race.name,
|
||||
race.id
|
||||
)
|
||||
|
||||
|
||||
if race_can_submit(r,race):
|
||||
records = IndoorVirtualRaceResult.objects.filter(
|
||||
userid = r.id,
|
||||
race=race
|
||||
)
|
||||
|
||||
if not records: # pragma: no cover
|
||||
return 0
|
||||
|
||||
record = records[0]
|
||||
|
||||
workouts = Workout.objects.filter(id=w.id)
|
||||
|
||||
result,comments,errors,jobid = add_workout_indoorrace(
|
||||
workouts,race,r,recordid=record.id
|
||||
)
|
||||
|
||||
|
||||
if result:
|
||||
otherrecords = IndoorVirtualRaceResult.objects.filter(
|
||||
race = race)
|
||||
|
||||
for otherrecord in otherrecords:
|
||||
otheruser = Rower.objects.get(id=otherrecord.userid)
|
||||
othername = otheruser.user.first_name+' '+otheruser.user.last_name
|
||||
registeredname = r.user.first_name+' '+r.user.last_name
|
||||
if otherrecord.emailnotifications:
|
||||
job = myqueue(
|
||||
queue,
|
||||
handle_sendemail_racesubmission,
|
||||
otheruser.user.email, othername,
|
||||
registeredname,
|
||||
race.name,
|
||||
race.id
|
||||
)
|
||||
|
||||
return 1
|
||||
else:
|
||||
return 0 # pragma: no cover
|
||||
else: # pragma: no cover
|
||||
|
||||
return 0
|
||||
|
||||
return 0 # pragma: no cover
|
||||
|
||||
|
||||
def race_can_register(r,race):
|
||||
if race.sessiontype in ['race']:
|
||||
|
||||
Reference in New Issue
Block a user