attempt to fix nk auto import
This commit is contained in:
@@ -158,7 +158,10 @@ class NKIntegration(SyncIntegration):
|
|||||||
|
|
||||||
# need to unify workout list
|
# need to unify workout list
|
||||||
def get_workout_list(self, *args, **kwargs) -> list:
|
def get_workout_list(self, *args, **kwargs) -> list:
|
||||||
|
try:
|
||||||
_ = self.open()
|
_ = self.open()
|
||||||
|
except NoTokenError:
|
||||||
|
return []
|
||||||
r = self.rower
|
r = self.rower
|
||||||
|
|
||||||
before = kwargs.get('before',0)
|
before = kwargs.get('before',0)
|
||||||
|
|||||||
@@ -2747,8 +2747,11 @@ def leaflet_chart_compare(course, workoutids, labeldict={}, startenddict={}):
|
|||||||
df.fillna(method='bfill', axis=0, inplace=True)
|
df.fillna(method='bfill', axis=0, inplace=True)
|
||||||
df.fillna(method='ffill', axis=0, inplace=True)
|
df.fillna(method='ffill', axis=0, inplace=True)
|
||||||
|
|
||||||
|
try:
|
||||||
lat = df['lat']
|
lat = df['lat']
|
||||||
lon = df['lon']
|
lon = df['lon']
|
||||||
|
except KeyError:
|
||||||
|
return [0, "invalid coordinate data"]
|
||||||
if lat.empty or lon.empty: # pragma: no cover
|
if lat.empty or lon.empty: # pragma: no cover
|
||||||
return [0, "invalid coordinate data"]
|
return [0, "invalid coordinate data"]
|
||||||
|
|
||||||
|
|||||||
@@ -83,21 +83,20 @@ class Command(BaseCommand):
|
|||||||
dologging('processemail.log', ''.join('!! ' + line for line in lines))
|
dologging('processemail.log', ''.join('!! ' + line for line in lines))
|
||||||
|
|
||||||
# Concept2
|
# Concept2
|
||||||
try:
|
|
||||||
rowers = Rower.objects.filter(c2_auto_import=True)
|
rowers = Rower.objects.filter(c2_auto_import=True)
|
||||||
for r in rowers: # pragma: no cover
|
for r in rowers: # pragma: no cover
|
||||||
|
try:
|
||||||
if user_is_not_basic(r.user) or user_is_coachee(r.user):
|
if user_is_not_basic(r.user) or user_is_coachee(r.user):
|
||||||
c2integration = C2Integration(r.user)
|
c2integration = C2Integration(r.user)
|
||||||
_ = c2integration.get_workouts()
|
_ = c2integration.get_workouts()
|
||||||
|
|
||||||
except: # pragma: no cover
|
except: # pragma: no cover
|
||||||
exc_type, exc_value, exc_traceback = sys.exc_info()
|
exc_type, exc_value, exc_traceback = sys.exc_info()
|
||||||
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||||
dologging('processemail.log', ''.join('!! ' + line for line in lines))
|
dologging('processemail.log', ''.join('!! ' + line for line in lines))
|
||||||
|
|
||||||
try:
|
|
||||||
rowers = Rower.objects.filter(rp3_auto_import=True)
|
rowers = Rower.objects.filter(rp3_auto_import=True)
|
||||||
for r in rowers: # pragma: no cover
|
for r in rowers: # pragma: no cover
|
||||||
|
try:
|
||||||
if user_is_not_basic(r.user) or user_is_coachee(r.user):
|
if user_is_not_basic(r.user) or user_is_coachee(r.user):
|
||||||
rp3_integration = RP3Integration(r.user)
|
rp3_integration = RP3Integration(r.user)
|
||||||
_ = rp3_integration.get_workouts()
|
_ = rp3_integration.get_workouts()
|
||||||
@@ -106,11 +105,11 @@ class Command(BaseCommand):
|
|||||||
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
lines = traceback.format_exception(exc_type, exc_value, exc_traceback)
|
||||||
dologging('processemail.log', ''.join('!! ' + line for line in lines))
|
dologging('processemail.log', ''.join('!! ' + line for line in lines))
|
||||||
|
|
||||||
try:
|
|
||||||
rowers = Rower.objects.filter(nk_auto_import=True)
|
rowers = Rower.objects.filter(nk_auto_import=True)
|
||||||
for r in rowers: # pragma: no cover
|
for r in rowers: # pragma: no cover
|
||||||
dologging("nklog.log","NK Auto import set for rower {id}".format(id=r.user.id))
|
try:
|
||||||
if user_is_not_basic(r.user) or user_is_coachee(r.user):
|
if user_is_not_basic(r.user) or user_is_coachee(r.user):
|
||||||
|
dologging("nklog.log","NK Auto import set for rower {id}".format(id=r.user.id))
|
||||||
nk_integration = NKIntegration(r.user)
|
nk_integration = NKIntegration(r.user)
|
||||||
_ = nk_integration.get_workouts()
|
_ = nk_integration.get_workouts()
|
||||||
except: # pragma: no cover
|
except: # pragma: no cover
|
||||||
|
|||||||
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