任务发送修改

This commit is contained in:
huang 2017-02-24 19:16:43 +08:00
parent 821dbe0ac2
commit c33ab7735f
1 changed files with 4 additions and 3 deletions

View File

@ -947,11 +947,12 @@ class ProjectsController < ApplicationController
# 测试,默认成功
if status == 0
ActiveRecord::Base.transaction do
if position <= original_tasks_count
if position < original_tasks_count
# 继续发布下一个任务
publish_training_tasks original_project_id, @training_task.project_id, position+1 if position < original_tasks_count
@training_task.update_attribute(:status, 1)
position = position + 1
publish_training_tasks original_project_id, @training_task.project_id, position
end
@training_task.update_attribute(:status, 1)
# 创建一条回复提醒
content = (position == original_tasks_count) ? "恭喜您,您已经完成了实训项目的所有任务" : "恭喜您,您已经完成了本任务"
add_training_task_journal(content, original_project.user_id)