not really importing the steps correctly
This commit is contained in:
@@ -699,28 +699,33 @@ def plannedsession_intervalsimport_view(request, message="", userid=0):
|
||||
sessions_list = integration.get_plannedsessions_list()
|
||||
|
||||
if request.method == 'POST': # pragma: no cover
|
||||
try:
|
||||
tdict = dict(request.POST.lists())
|
||||
print(tdict)
|
||||
ids = tdict['session']
|
||||
sessionids = [int(id) for id in ids]
|
||||
for sessionid in sessionids:
|
||||
try:
|
||||
_ = integration.get_plannedsession(sessionid)
|
||||
except NoTokenError:
|
||||
pass
|
||||
messages.info(
|
||||
request,
|
||||
'Your Intervals.icu planned sessions will be imported in the background.'
|
||||
' It may take a few minutes before they appear.')
|
||||
tdict = dict(request.POST.lists())
|
||||
sessionids = [id for id in tdict['session']]
|
||||
for sessionid in sessionids:
|
||||
sessiondata = integration.get_plannedsession(sessionid)
|
||||
if sessiondata:
|
||||
ps = PlannedSession(
|
||||
name=sessiondata['name'],
|
||||
comment=sessiondata['description'],
|
||||
startdate=arrow.get(sessiondata['start_date_local']).datetime,
|
||||
enddate=arrow.get(sessiondata['end_date_local']).datetime,
|
||||
preferreddate=arrow.get(sessiondata['start_date_local']).datetime,
|
||||
sessionsport=mytypes.intervalsmappinginv[sessiondata['type']],
|
||||
sessiontype='session',
|
||||
intervals_icu_id=sessiondata['id'],
|
||||
manager=request.user,
|
||||
fitfile=sessiondata['fitfile'],
|
||||
)
|
||||
ps.save()
|
||||
ps.rower.add(r)
|
||||
ps.update_steps()
|
||||
url = reverse('plannedsessions_view')
|
||||
return HttpResponseRedirect(url)
|
||||
except KeyError:
|
||||
pass
|
||||
return HttpResponseRedirect(url)
|
||||
|
||||
|
||||
return render(request, 'intervals_list_import.html',
|
||||
{
|
||||
'folders': sessions_list,
|
||||
'sessions': sessions_list,
|
||||
'rower': r,
|
||||
'active': 'nav-plans',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user