fixing issues
This commit is contained in:
@@ -1648,7 +1648,7 @@ def read_data(columns, ids=[], doclean=True, workstrokesonly=True, debug=False,
|
|||||||
datadf = pl.concat(data)
|
datadf = pl.concat(data)
|
||||||
existing_columns = [col for col in columns if col in datadf.columns]
|
existing_columns = [col for col in columns if col in datadf.columns]
|
||||||
datadf = datadf.select(existing_columns)
|
datadf = datadf.select(existing_columns)
|
||||||
except (ShapeError, SchemaError):
|
except ShapeError:
|
||||||
try:
|
try:
|
||||||
data = [
|
data = [
|
||||||
df.select(columns)
|
df.select(columns)
|
||||||
@@ -1703,7 +1703,61 @@ def read_data(columns, ids=[], doclean=True, workstrokesonly=True, debug=False,
|
|||||||
datadf = pl.concat(data)
|
datadf = pl.concat(data)
|
||||||
except ShapeError:
|
except ShapeError:
|
||||||
return pl.DataFrame()
|
return pl.DataFrame()
|
||||||
|
except SchemaError:
|
||||||
|
try:
|
||||||
|
data = [
|
||||||
|
df.select(columns)
|
||||||
|
for df in data]
|
||||||
|
except ColumnNotFoundError:
|
||||||
|
existing_columns = [col for col in columns if col in df.columns]
|
||||||
|
df = df.select(existing_columns)
|
||||||
|
|
||||||
|
# float columns
|
||||||
|
floatcolumns = []
|
||||||
|
intcolumns = []
|
||||||
|
stringcolumns = []
|
||||||
|
for c in columns:
|
||||||
|
try:
|
||||||
|
if metricsdicts[c]['numtype'] == 'float':
|
||||||
|
floatcolumns.append(c)
|
||||||
|
if metricsdicts[c]['numtype'] == 'integer':
|
||||||
|
intcolumns.append(c)
|
||||||
|
except KeyError:
|
||||||
|
if c[0] == 'f':
|
||||||
|
stringcolumns.append(c)
|
||||||
|
else:
|
||||||
|
intcolumns.append(c)
|
||||||
|
|
||||||
|
try:
|
||||||
|
data = [
|
||||||
|
df.with_columns(
|
||||||
|
cs.float().cast(pl.Float64)
|
||||||
|
).with_columns(
|
||||||
|
cs.integer().cast(pl.Int64)
|
||||||
|
).with_columns(
|
||||||
|
cs.by_name(intcolumns).cast(pl.Int64)
|
||||||
|
).with_columns(
|
||||||
|
cs.by_name(floatcolumns).cast(pl.Float64)
|
||||||
|
).with_columns(
|
||||||
|
cs.by_name(stringcolumns).cast(pl.String)
|
||||||
|
)
|
||||||
|
for df in data
|
||||||
|
]
|
||||||
|
except ComputeError:
|
||||||
|
pass
|
||||||
|
except ColumnNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
try:
|
||||||
|
datadf = pl.concat(data)
|
||||||
|
except SchemaError:
|
||||||
|
try:
|
||||||
|
data = [
|
||||||
|
df.with_columns(cs.integer().cast(pl.Float64)) for df in data
|
||||||
|
]
|
||||||
|
datadf = pl.concat(data)
|
||||||
|
except ShapeError:
|
||||||
|
return pl.DataFrame()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3830,6 +3830,36 @@ class Workout(models.Model):
|
|||||||
record.boatclass = self.workouttype
|
record.boatclass = self.workouttype
|
||||||
record.save()
|
record.save()
|
||||||
|
|
||||||
|
if self.uploadedtostrava:
|
||||||
|
record = create_or_update_syncrecord(self.user, self,
|
||||||
|
stravaid=self.uploadedtostrava,
|
||||||
|
)
|
||||||
|
if self.uploadedtointervals:
|
||||||
|
record = create_or_update_syncrecord(self.user, self,
|
||||||
|
intervalsid= self.uploadedtointervals,
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.uploadedtotp:
|
||||||
|
record = create_or_update_syncrecord(self.user, self,
|
||||||
|
tpid= self.uploadedtotp,
|
||||||
|
)
|
||||||
|
if self.uploadedtonk:
|
||||||
|
record = create_or_update_syncrecord(self.user, self,
|
||||||
|
nkid= self.uploadedtonk,
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.uploadedtosporttracks:
|
||||||
|
record = create_or_update_syncrecord(self.user, self,
|
||||||
|
sporttracksid=self.uploadedtosporttracks,
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.uploadedtoc2:
|
||||||
|
record = create_or_update_syncrecord(self.user, self,
|
||||||
|
c2id= self.uploadedtoc2,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
super(Workout, self).save(*args, **kwargs)
|
super(Workout, self).save(*args, **kwargs)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@@ -4006,7 +4036,7 @@ def create_or_update_syncrecord(rower, workout, **kwargs):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
record.save()
|
record.save()
|
||||||
except IntegrityError:
|
except (IntegrityError, ValueError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return record
|
return record
|
||||||
|
|||||||
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
BIN
rowers/tests/testdata/testdata.tcx.gz
vendored
Binary file not shown.
Reference in New Issue
Block a user