unfinished, untested
This commit is contained in:
@@ -637,6 +637,35 @@ def workout_nkimport_view(request,userid=0,after=0,before=0):
|
||||
|
||||
workouts = workouts[::-1]
|
||||
|
||||
if request.method == 'POST':
|
||||
try:
|
||||
tdict = dict(request.POST.lists())
|
||||
ids = tdict['workoutid']
|
||||
nkids = [int(id) for id in ids]
|
||||
alldata = {}
|
||||
|
||||
for item in res.json()['data']:
|
||||
alldata[item['id']] = item
|
||||
counter = 0
|
||||
for nkid in nkids:
|
||||
csvfilename = 'media/{code}_{nkid}.csv'.format(code=uuid4().hex[:16],nkid=nkid)
|
||||
result = myqueue(
|
||||
queue,
|
||||
handle_nk_async_workout,
|
||||
alldata,
|
||||
r.user.id,
|
||||
r.nktoken,
|
||||
nkid,
|
||||
counter,
|
||||
r.defaulttimezone
|
||||
)
|
||||
counter = counter+1
|
||||
messages.info(request,'Your NK logbook workouts will be imported in the background. It may take a few minutes before it appears.'.format(c2id=c2id))
|
||||
url = reverse('workouts_view')
|
||||
return HttpResponseRedirect(url)
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
breadcrumbs = [
|
||||
{
|
||||
'url':'/rowers/list-workouts/',
|
||||
|
||||
Reference in New Issue
Block a user