def task_progress(pid): tasks = Task.all_tasks(pid) task_lists = [] for task in tasks: t = { 'id': task.id, 'task_no': task.task_no, 'project_id': task.project_id, 'create_user': task.create_user, 'create_user_name': task.create_user_name, 'total': task.total, 'success': task.success, 'fail': task.fail, 'create_time': task.create_time, 'update_time': task.update_time, } task_lists.append(t) socket_io.emit('task', {'tasks': task_lists, 'project_id': int(pid)}) return Success(msg='广播成功')
def all_tasks(): form = TaskSearchForm().validate_for_api() tasks = Task.all_tasks(form.project.data) return jsonify(tasks)