#task_histories
This commit is contained in:
parent
2ba900cb02
commit
a34971dfe0
|
@ -77,27 +77,28 @@ def task_histories(request):
|
||||||
histories = []
|
histories = []
|
||||||
task_id = []
|
task_id = []
|
||||||
|
|
||||||
|
res = []
|
||||||
|
row1 = None
|
||||||
with connection.cursor() as cursor:
|
with connection.cursor() as cursor:
|
||||||
cursor.execute("select * from task_histories order by run_time desc limit 20;")
|
cursor.execute("select * from task_histories order by run_time desc limit 20;")
|
||||||
row = cursor.fetchall()
|
row = cursor.fetchall()
|
||||||
res = []
|
task = []
|
||||||
|
|
||||||
for r in row:
|
for r in row:
|
||||||
o = dict()
|
|
||||||
print(r)
|
|
||||||
histories.append(r)
|
|
||||||
task_id.append(r[1])
|
task_id.append(r[1])
|
||||||
|
o = dict()
|
||||||
o['status'] = r[2]
|
o['status'] = r[2]
|
||||||
o['run_time'] = r[3]
|
o['run_time'] = r[3]
|
||||||
o['output'] = r[4][1:-1]
|
o['output'] = r[4][1:-1]
|
||||||
|
task.append(o)
|
||||||
|
|
||||||
with connection.cursor() as cursor1:
|
with connection.cursor() as cursor1:
|
||||||
cursor1.execute("select * from tasks where id = '%s'" % (r[1]))
|
cursor1.execute("select * from tasks where id = '%s' limit 1" % (r[1]))
|
||||||
row1 = cursor1.fetchall()
|
row1 = cursor1.fetchone()
|
||||||
for r1 in row1:
|
task.append(row1[1])
|
||||||
o['task_name'] = r1[1]
|
task.append(row1[2])
|
||||||
o['task_type'] = r1[2]
|
task.append(row1[8])
|
||||||
o['desc'] = r1[8]
|
res.append(task)
|
||||||
res.append(o)
|
|
||||||
return HttpResponse(json.dumps({
|
return HttpResponse(json.dumps({
|
||||||
"status":"1",
|
"status":"1",
|
||||||
"res":res
|
"res":res
|
||||||
|
|
Loading…
Reference in New Issue