testing
This commit is contained in:
@@ -29,6 +29,7 @@ import itertools
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import polars as pl
|
||||
from polars.exceptions import ColumnNotFoundError
|
||||
from zipfile import BadZipFile
|
||||
import zipfile
|
||||
import os
|
||||
@@ -422,7 +423,8 @@ def calculate_goldmedalstandard(rower, workout, recurrance=True):
|
||||
try:
|
||||
df = pl.read_parquet(cpfile)
|
||||
except:
|
||||
df = getsmallrowdata_pl(['power'], ids=[workout.id])
|
||||
df = read_data(['power'], ids=[workout.id])
|
||||
df = remove_nulls_pl(df)
|
||||
background = True
|
||||
if settings.TESTING:
|
||||
background = False
|
||||
@@ -525,8 +527,9 @@ def setcp(workout, background=False, recurrance=True):
|
||||
except Exception as e:
|
||||
pass
|
||||
|
||||
strokesdf = getsmallrowdata_pl(
|
||||
strokesdf = read_data(
|
||||
['power', 'workoutid', 'time'], ids=[workout.id])
|
||||
strokesdf = remove_nulls_pl(strokesdf)
|
||||
|
||||
if strokesdf.is_empty():
|
||||
return pl.DataFrame({'delta': [], 'cp': []}), pl.Series(dtype=pl.Float64), pl.Series(dtype=pl.Float64)
|
||||
@@ -617,14 +620,10 @@ def update_wps(r, types, mode='water', asynchron=True):
|
||||
mode
|
||||
)
|
||||
|
||||
df = getsmallrowdata_db(['time', 'driveenergy'], ids=ids)
|
||||
df = read_data(['time', 'driveenergy'], ids=ids)
|
||||
|
||||
try:
|
||||
mask = df['driveenergy'] > 100
|
||||
except (KeyError, TypeError):
|
||||
return False
|
||||
try:
|
||||
wps_median = int(df.loc[mask, 'driveenergy'].median())
|
||||
wps_median = int(df.filter(pl.col("driveenergy")>100)["driveenergy"].median())
|
||||
if mode == 'water':
|
||||
r.median_wps = wps_median
|
||||
else: # pragma: no cover
|
||||
@@ -635,6 +634,8 @@ def update_wps(r, types, mode='water', asynchron=True):
|
||||
pass
|
||||
except OverflowError:
|
||||
pass
|
||||
except ColumnNotFoundError:
|
||||
pass
|
||||
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user