yeq6x commited on
Commit
3993e1b
·
1 Parent(s): 46bd384

get_active_task_order

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -244,8 +244,13 @@ def task_status(task_id):
244
  return jsonify({'error': str(e)}), 500
245
 
246
  def get_active_task_order(task_id):
 
247
  non_processing_task_ids = [tid for tid, task in active_tasks.items() if not task.is_processing]
248
- return non_processing_task_ids.index(task_id)+1 if task_id in non_processing_task_ids else 0
 
 
 
 
249
 
250
  # get_task_orderイベントハンドラー
251
  @app.route('/get_task_order/<task_id>', methods=['GET'])
 
244
  return jsonify({'error': str(e)}), 500
245
 
246
  def get_active_task_order(task_id):
247
+ processing_task_ids = [tid for tid, task in active_tasks.items() if task.is_processing]
248
  non_processing_task_ids = [tid for tid, task in active_tasks.items() if not task.is_processing]
249
+ if len(processing_task_ids) == 0:
250
+ task_order = 0
251
+ else:
252
+ task_order = non_processing_task_ids.index(task_id) + 1
253
+ return task_order
254
 
255
  # get_task_orderイベントハンドラー
256
  @app.route('/get_task_order/<task_id>', methods=['GET'])