Commit 51c2768d authored by Andreas Valder's avatar Andreas Valder
Browse files

fixed pagination for jobs

parent cda90899
......@@ -15,7 +15,6 @@ def jobs_overview():
pagesize = min(500, int(request.args['pagesize']))
else:
pagesize = 50
pagecount = math.ceil(query('SELECT count(id) as count FROM jobs')[0]['count']/pagesize)
worker = query('SELECT * FROM worker ORDER BY last_ping DESC')
......@@ -31,6 +30,7 @@ def jobs_overview():
'state': request.args.get('state','failed'),
'worker': request.args.get('worker','%') }
pagecount = math.ceil(query('SELECT count(id) as count FROM jobs WHERE (type like ?) AND (worker like ? OR (worker IS NULL AND ? = "%")) AND (state like ?)', filter['type'], filter['worker'], filter['worker'], filter['state'])[0]['count']/pagesize)
jobs = query('SELECT * FROM jobs WHERE (type like ?) AND (worker like ? OR (worker IS NULL AND ? = "%")) AND (state like ?) ORDER BY `time_created` DESC LIMIT ? OFFSET ?', filter['type'], filter['worker'], filter['worker'], filter['state'], pagesize, page*pagesize)
return render_template('jobs_overview.html',worker=worker,jobs=jobs, filter_values=filter_values, filter=filter, page=page, pagesize=pagesize, pagecount=pagecount)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment