Private
Public Access
1
0

Merge branch 'release/v23.3.1'

This commit is contained in:
2025-02-21 17:26:30 +01:00
4 changed files with 37 additions and 8 deletions
+29 -1
View File
@@ -123,6 +123,7 @@ class IntervalsIntegration(SyncIntegration):
try: try:
row = rowingdata(csvfile=filename) row = rowingdata(csvfile=filename)
except IOError: # pragma: no cover except IOError: # pragma: no cover
dologging('intervals.icu.log', "Could not open file {filename}".format(filename=filename))
data = dataprep.read_df_sql(w.id) data = dataprep.read_df_sql(w.id)
try: try:
datalength = len(data) datalength = len(data)
@@ -136,8 +137,10 @@ class IntervalsIntegration(SyncIntegration):
try: try:
row = rowingdata(csvfile=filename) row = rowingdata(csvfile=filename)
except IOError: # pragma: no cover except IOError: # pragma: no cover
dologging('intervals.icu.log', "Could not open file {filename}".format(filename=filename))
return '' # pragma: no cover return '' # pragma: no cover
else: else:
dologging('intervals.icu.log', "Could not create data for workout {id}".format(id=w.id))
return '' return ''
tcxfilename = w.csvfilename[:-4] + '.tcx' tcxfilename = w.csvfilename[:-4] + '.tcx'
@@ -146,7 +149,7 @@ class IntervalsIntegration(SyncIntegration):
except TypeError: except TypeError:
newnotes = 'from'+w.workoutsource+' via rowsandall.com' newnotes = 'from'+w.workoutsource+' via rowsandall.com'
if w.user.intervals_resample_to_1s and w_resampled: if w_resampled:
w_resampled.delete() w_resampled.delete()
row.exporttotcx(tcxfilename, notes=newnotes, sport=mytypes.intervalsmapping[w.workouttype]) row.exporttotcx(tcxfilename, notes=newnotes, sport=mytypes.intervalsmapping[w.workouttype])
if dozip: if dozip:
@@ -161,6 +164,7 @@ class IntervalsIntegration(SyncIntegration):
except WindowsError: # pragma: no cover except WindowsError: # pragma: no cover
pass pass
except FileNotFoundError: except FileNotFoundError:
dologging('intervals.icu.log', "Could not open file {filename}".format(filename=tcxfilename))
return '' return ''
return gzfilename return gzfilename
@@ -177,6 +181,7 @@ class IntervalsIntegration(SyncIntegration):
filename = self.createworkoutdata(workout) filename = self.createworkoutdata(workout)
if not filename: if not filename:
dologging('intervals.icu.log', "Could not create data for workout {id}".format(id=workout.id))
return 0 return 0
params = { params = {
@@ -227,6 +232,7 @@ class IntervalsIntegration(SyncIntegration):
response = requests.put(url, headers=headers, json=jsondict) response = requests.put(url, headers=headers, json=jsondict)
if response.status_code not in [200, 201]: if response.status_code not in [200, 201]:
dologging('intervals.icu.log', response.reason)
return 0 return 0
@@ -471,6 +477,20 @@ class IntervalsIntegration(SyncIntegration):
except KeyError: except KeyError:
is_commute = False is_commute = False
try:
is_race = data['race']
if is_race is None:
is_race = False
except KeyError:
is_race = False
try:
subtype = data['sub_type']
if subtype is not None:
subtype = subtype.capitalize()
except KeyError:
subtype = None
try: try:
workouttype = mytypes.intervalsmappinginv[data['type']] workouttype = mytypes.intervalsmappinginv[data['type']]
except KeyError: except KeyError:
@@ -520,9 +540,17 @@ class IntervalsIntegration(SyncIntegration):
pair_id = data['paired_event_id'] pair_id = data['paired_event_id']
pss = PlannedSession.objects.filter(intervals_icu_id=pair_id, rower=r) pss = PlannedSession.objects.filter(intervals_icu_id=pair_id, rower=r)
ws = Workout.objects.filter(uploadedtointervals=id) ws = Workout.objects.filter(uploadedtointervals=id)
for w in ws:
w.sub_type = subtype
w.save()
if is_commute: if is_commute:
for w in ws: for w in ws:
w.is_commute = True w.is_commute = True
w.sub_type = "Commute"
w.save()
if is_race:
for w in ws:
w.is_race = True
w.save() w.save()
if pss.count() > 0: if pss.count() > 0:
for ps in pss: for ps in pss:
+6 -5
View File
@@ -3680,17 +3680,18 @@ def handle_intervals_getworkout(rower, intervalstoken, workoutid, debug=False, *
try: try:
paired_event_id = data['paired_event_id'] paired_event_id = data['paired_event_id']
ws = Workout.objects.filter(uploadedtointervals=workoutid) ws = Workout.objects.filter(uploadedtointervals=workoutid)
for w in ws:
w.sub_type = subtype
w.save()
if is_commute: if is_commute:
for w in ws: for w in ws:
w.is_commute = True w.is_commute = True
w.sub_type = "Commute" w.sub_type = "Commute"
w.save() w.save()
for w in ws:
w.sub_type = subtype
w.save()
if is_race: if is_race:
w.is_race = True for w in ws:
w.save() w.is_race = True
w.save()
if ws.count() > 0: if ws.count() > 0:
pss = PlannedSession.objects.filter(rower=rower,intervals_icu_id=paired_event_id) pss = PlannedSession.objects.filter(rower=rower,intervals_icu_id=paired_event_id)
if pss.count() > 0: if pss.count() > 0:
Binary file not shown.
+2 -2
View File
@@ -4537,9 +4537,9 @@ def workout_edit_view(request, id=0, message="", successmessage=""):
boatname = form.cleaned_data.get('boatname', '') boatname = form.cleaned_data.get('boatname', '')
empowerside = form.cleaned_data.get('empowerside','port') empowerside = form.cleaned_data.get('empowerside','port')
if is_race and subtype is None: if is_race:
subtype = "Race" subtype = "Race"
elif is_commute and subtype is None: elif is_commute:
subtype = "Commute" subtype = "Commute"
if private: if private: