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