Private
Public Access
1
0

removing ftp warning in a more elegant way, still need to implement

regular sending
This commit is contained in:
Sander Roosendaal
2023-05-11 23:11:22 +02:00
parent d6b303ba47
commit e6fbd34780
4 changed files with 6 additions and 6 deletions

View File

@@ -712,7 +712,7 @@ def fetchcp(rower, theworkouts, table='cpdata'): # pragma: no cover
return pd.Series([], dtype='float'), pd.Series([], dtype='float'), avgpower2
def update_rolling_cp(r, types, mode='water'):
def update_rolling_cp(r, types, mode='water', dosend=False):
firstdate = timezone.now()-datetime.timedelta(days=r.cprange)
workouts = Workout.objects.filter(
date__gte=firstdate,
@@ -747,7 +747,7 @@ def update_rolling_cp(r, types, mode='water'):
r.p3 = p1[3]
r.cpratio = res2[3]
r.save()
if pwr-5 > r.ftp*(100.-r.otwslack)/100. and r.getemailnotifications and not r.emailbounced:
if dosend and pwr-5 > r.ftp*(100.-r.otwslack)/100. and r.getemailnotifications and not r.emailbounced:
_ = myqueue(queuehigh, handle_sendemail_newftp,r,pwr,'water')
else:
@@ -757,7 +757,7 @@ def update_rolling_cp(r, types, mode='water'):
r.ep3 = p1[3]
r.ecpratio = res2[3]
r.save()
if pwr-5 > r.ftp and r.getemailnotifications and not r.emailbounced:
if dosend and pwr-5 > r.ftp and r.getemailnotifications and not r.emailbounced:
_ = myqueue(queuehigh, handle_sendemail_newftp,r,pwr,'water')

View File

@@ -1281,6 +1281,8 @@ def handle_get_garmin_file(client_id,
*args,
**kwargs):
dologging('garminlog.log','Fetching URL {url}'.format(url=url))
regex = '.*\?id=(\d+)'
try: # pragma: no cover
m = re.compile(regex).match(url).group(1)
@@ -2000,9 +2002,6 @@ def handle_sendemail_expired(useremail, userfirstname, userlastname, expireddate
@app.task
def handle_sendemail_newftp(rower,power,mode, **kwargs):
# temporary, delete following line after implementing sending these emails once per week
return 1
subject = "You may want to update your FTP on rowsandall.com"
from_email = 'Rowsandall <info@rowsandall.com>'

Binary file not shown.

View File

@@ -5211,6 +5211,7 @@ def workout_upload_api(request):
# sync related IDs
sporttracksid = post_data.get('sporttracksid','')
c2id = post_data.get('c2id', '')
garminid = post_data.get('garminid','')
workoutid = post_data.get('id','')
startdatetime = post_data.get('startdatetime', '')
oarlockfirmware = post_data.get('oarlockfirmware', None)