|
|
@ -1,18 +1,18 @@
|
|
|
|
class GraduationWorksController < ApplicationController
|
|
|
|
class GraduationWorksController < ApplicationController
|
|
|
|
before_action :require_login, :check_auth
|
|
|
|
before_action :require_login, :check_auth
|
|
|
|
before_action :find_task, only: [:new, :create, :search_member_list, :check_project, :relate_project,
|
|
|
|
before_action :find_task, only: [:new, :create, :search_member_list, :check_project, :relate_project,
|
|
|
|
:cancel_relate_project]
|
|
|
|
:cancel_relate_project, :delete_work]
|
|
|
|
before_action :find_work, only: [:show, :edit, :update, :revise_attachment, :supply_attachments, :comment_list,
|
|
|
|
before_action :find_work, only: [:show, :edit, :update, :revise_attachment, :supply_attachments, :comment_list,
|
|
|
|
:add_score, :delete_score, :adjust_score, :assign_teacher]
|
|
|
|
:add_score, :delete_score, :adjust_score, :assign_teacher]
|
|
|
|
before_action :user_course_identity
|
|
|
|
before_action :user_course_identity
|
|
|
|
before_action :task_public
|
|
|
|
before_action :task_public
|
|
|
|
before_action :teacher_allowed, only: [:add_score, :adjust_score, :assign_teacher]
|
|
|
|
before_action :teacher_allowed, only: [:add_score, :adjust_score, :assign_teacher]
|
|
|
|
before_action :course_student, only: [:new, :create, :edit, :update, :search_member_list, :relate_project,
|
|
|
|
before_action :course_student, only: [:new, :create, :edit, :update, :search_member_list, :relate_project,
|
|
|
|
:cancel_relate_project]
|
|
|
|
:cancel_relate_project, :delete_work]
|
|
|
|
before_action :my_work, only: [:edit, :update, :revise_attachment]
|
|
|
|
before_action :my_work, only: [:edit, :update, :revise_attachment]
|
|
|
|
before_action :published_task, only: [:new, :create, :edit, :update, :search_member_list, :relate_project,
|
|
|
|
before_action :published_task, only: [:new, :create, :edit, :update, :search_member_list, :relate_project,
|
|
|
|
:cancel_relate_project, :revise_attachment]
|
|
|
|
:cancel_relate_project, :revise_attachment]
|
|
|
|
before_action :edit_duration, only: [:edit, :update]
|
|
|
|
before_action :edit_duration, only: [:edit, :update, :delete_work]
|
|
|
|
before_action :open_work, only: [:show, :supply_attachments, :comment_list]
|
|
|
|
before_action :open_work, only: [:show, :supply_attachments, :comment_list]
|
|
|
|
|
|
|
|
|
|
|
|
def new
|
|
|
|
def new
|
|
|
@ -47,6 +47,24 @@ class GraduationWorksController < ApplicationController
|
|
|
|
@members = @members.page(page).per(limit).includes(:course_group, user: :user_extension)
|
|
|
|
@members = @members.page(page).per(limit).includes(:course_group, user: :user_extension)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def delete_work
|
|
|
|
|
|
|
|
ActiveRecord::Base.transaction do
|
|
|
|
|
|
|
|
begin
|
|
|
|
|
|
|
|
work = @task.graduation_works.find_by!(user_id: params[:user_id])
|
|
|
|
|
|
|
|
tip_exception("只有组长才能删除组员") if work.commit_user_id != current_user.id
|
|
|
|
|
|
|
|
work.update_attributes(description: nil, project_id: 0, late_penalty: 0, work_status: 0, commit_time: nil,
|
|
|
|
|
|
|
|
update_time: nil, group_id: 0, commit_user_id: nil, final_score: nil, work_score: nil,
|
|
|
|
|
|
|
|
teacher_score: nil, teaching_asistant_score: nil, update_user_id: nil)
|
|
|
|
|
|
|
|
work.attachments.destroy_all
|
|
|
|
|
|
|
|
work.tidings.destroy_all
|
|
|
|
|
|
|
|
normal_status("删除成功")
|
|
|
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
|
|
|
uid_logger(e.message)
|
|
|
|
|
|
|
|
tip_exception(e.message)
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
# 判断项目是否已有其他作品关联上了
|
|
|
|
# 判断项目是否已有其他作品关联上了
|
|
|
|
def check_project
|
|
|
|
def check_project
|
|
|
|
tip_exception("项目id不能为空") if params[:project_id].blank?
|
|
|
|
tip_exception("项目id不能为空") if params[:project_id].blank?
|
|
|
@ -371,6 +389,11 @@ class GraduationWorksController < ApplicationController
|
|
|
|
new_score.save!
|
|
|
|
new_score.save!
|
|
|
|
@work.update_attributes(ultimate_score: 1, work_score: params[:score].to_f)
|
|
|
|
@work.update_attributes(ultimate_score: 1, work_score: params[:score].to_f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Tiding.create!(user_id: @work.user_id, trigger_user_id: current_user.id, container_id: new_score.id,
|
|
|
|
|
|
|
|
container_type: "AdjustScore", parent_container_id: @task.id,
|
|
|
|
|
|
|
|
parent_container_type: "GraduationTask", belong_container_id: @course.id,
|
|
|
|
|
|
|
|
belong_container_type: 'Course', tiding_type: "GraduationTask")
|
|
|
|
|
|
|
|
|
|
|
|
normal_status("调分成功")
|
|
|
|
normal_status("调分成功")
|
|
|
|
rescue Exception => e
|
|
|
|
rescue Exception => e
|
|
|
|
uid_logger(e.message)
|
|
|
|
uid_logger(e.message)
|
|
|
|