Merge branch 'release/v22.1.20'
This commit is contained in:
+7
-3
@@ -766,8 +766,12 @@ def fetchcp_new(rower, workouts):
|
|||||||
if len(data) > 1:
|
if len(data) > 1:
|
||||||
df = pl.concat(data)
|
df = pl.concat(data)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
df = df.group_by(pl.col("delta")).agg(pl.max("cp"), pl.max("workout"), pl.max("url")).sort("delta")
|
#df = df.group_by(pl.col("delta")).agg(pl.max("cp"), pl.max("workout"), pl.max("url")).sort("delta")
|
||||||
|
df = df.groupby('delta').agg([
|
||||||
|
pl.all().sort_by('cp').last(),
|
||||||
|
])
|
||||||
except (KeyError, ColumnNotFoundError): # pragma: no cover
|
except (KeyError, ColumnNotFoundError): # pragma: no cover
|
||||||
return pl.Series(dtype=pl.Float64), pl.Series(dtype=pl.Float64), 0, pl.Series(dtype=pl.Float64), pl.Series(dtype=pl.Float64)
|
return pl.Series(dtype=pl.Float64), pl.Series(dtype=pl.Float64), 0, pl.Series(dtype=pl.Float64), pl.Series(dtype=pl.Float64)
|
||||||
|
|
||||||
@@ -1077,7 +1081,7 @@ def checkbreakthrough(w, r):
|
|||||||
r.user.email,
|
r.user.email,
|
||||||
r.user.first_name,
|
r.user.first_name,
|
||||||
r.user.last_name,
|
r.user.last_name,
|
||||||
btvalues=btvalues.write_json())
|
btvalues=btvalues.write_json(row_oriented=True))
|
||||||
for coach in r.get_coaches():
|
for coach in r.get_coaches():
|
||||||
if coach.getemailnotifications and not coach.emailbounced:
|
if coach.getemailnotifications and not coach.emailbounced:
|
||||||
_ = myqueue(queuehigh, handle_sendemail_breakthrough,
|
_ = myqueue(queuehigh, handle_sendemail_breakthrough,
|
||||||
@@ -1085,7 +1089,7 @@ def checkbreakthrough(w, r):
|
|||||||
coach.user.email,
|
coach.user.email,
|
||||||
r.user.first_name,
|
r.user.first_name,
|
||||||
r.user.last_name,
|
r.user.last_name,
|
||||||
btvalues=btvalues.write_json(),
|
btvalues=btvalues.write_json(row_oriented=True),
|
||||||
surname=True)
|
surname=True)
|
||||||
|
|
||||||
# submit email task to send email about breakthrough workout
|
# submit email task to send email about breakthrough workout
|
||||||
|
|||||||
+3
-2
@@ -13,7 +13,7 @@ from scipy import optimize
|
|||||||
import rowingdata
|
import rowingdata
|
||||||
|
|
||||||
from rowingdata import rowingdata as rdata
|
from rowingdata import rowingdata as rdata
|
||||||
|
from rowers.utils import dologging
|
||||||
from celery import app
|
from celery import app
|
||||||
import datetime
|
import datetime
|
||||||
import pytz
|
import pytz
|
||||||
@@ -132,7 +132,8 @@ def send_template_email(from_email, to_email, subject,
|
|||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
pass
|
dologging('tasks.log',e)
|
||||||
|
|
||||||
|
|
||||||
if not emailbounced:
|
if not emailbounced:
|
||||||
res = msg.send()
|
res = msg.send()
|
||||||
|
|||||||
@@ -2160,10 +2160,13 @@ def handle_sendemail_breakthrough(workoutid, useremail,
|
|||||||
surname=False,
|
surname=False,
|
||||||
**kwargs):
|
**kwargs):
|
||||||
|
|
||||||
|
dologging('tasks.log',btvalues)
|
||||||
btvalues = pd.read_json(btvalues)
|
btvalues = pd.read_json(btvalues)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
btvalues.sort_values('delta', axis=0, inplace=True)
|
btvalues.sort_values('delta', axis=0, inplace=True)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
dologging('tasks.log','KeyError')
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
lastname = ''
|
lastname = ''
|
||||||
|
|||||||
BIN
Binary file not shown.
+6
-3
@@ -361,9 +361,12 @@ def isbreakthrough(delta, cpvalues, p0, p1, p2, p3, ratio):
|
|||||||
|
|
||||||
pwr *= ratio
|
pwr *= ratio
|
||||||
|
|
||||||
delta = delta.cast(pl.Int32)
|
try:
|
||||||
cpvalues = cpvalues.cast(pl.Int32)
|
delta = delta.cast(pl.Int32)
|
||||||
pwr = pwr.cast(pl.Int32)
|
cpvalues = cpvalues.cast(pl.Int32)
|
||||||
|
pwr = pwr.cast(pl.Int32)
|
||||||
|
except:
|
||||||
|
return False, pl.DataFrame(), False
|
||||||
|
|
||||||
btdf = pl.DataFrame({
|
btdf = pl.DataFrame({
|
||||||
'delta': delta,
|
'delta': delta,
|
||||||
|
|||||||
Reference in New Issue
Block a user