|
|
|
@ -4,7 +4,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
before_action :require_login, :check_auth
|
|
|
|
|
before_action :find_homework, only: [:new, :create, :search_member_list, :check_project, :relate_project,
|
|
|
|
|
:cancel_relate_project]
|
|
|
|
|
:cancel_relate_project, :delete_work]
|
|
|
|
|
before_action :find_work, only: [:shixun_work_report, :adjust_review_score, :shixun_work, :commit_des, :update_des,
|
|
|
|
|
:adjust_score, :show, :adjust_score, :supply_attachments, :revise_attachment,
|
|
|
|
|
:comment_list, :add_score, :add_score_reply, :destroy_score, :appeal_anonymous_score,
|
|
|
|
@ -15,12 +15,12 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
|
|
|
|
|
before_action :teacher_allowed, only: [:adjust_score, :adjust_review_score, :deal_appeal_score]
|
|
|
|
|
before_action :course_student, only: [:new, :commit_des, :update_des, :create, :edit, :update, :search_member_list, :relate_project,
|
|
|
|
|
:cancel_relate_project, :relate_project]
|
|
|
|
|
:cancel_relate_project, :relate_project, :delete_work]
|
|
|
|
|
|
|
|
|
|
before_action :my_work, only: [:commit_des, :update_des, :edit, :update, :revise_attachment, :appeal_anonymous_score,
|
|
|
|
|
:cancel_appeal]
|
|
|
|
|
|
|
|
|
|
before_action :edit_duration, only: [:edit, :update]
|
|
|
|
|
before_action :edit_duration, only: [:edit, :update, :delete_work]
|
|
|
|
|
before_action :end_or_late, only: [:new, :create, :search_member_list, :commit_des, :update_des]
|
|
|
|
|
|
|
|
|
|
before_action :require_score_id, only: [:destroy_score, :add_score_reply, :appeal_anonymous_score, :deal_appeal_score, :cancel_appeal]
|
|
|
|
@ -60,6 +60,20 @@ class StudentWorksController < ApplicationController
|
|
|
|
|
@members = @members.page(page).per(limit).includes(:course_group, user: :user_extension)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def delete_work
|
|
|
|
|
begin
|
|
|
|
|
work = @homework.student_works.find_by!(user_id: params[: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)
|
|
|
|
|
normal_status("删除成功")
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger(e.message)
|
|
|
|
|
tip_exception(e.message)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def create
|
|
|
|
|
student_work = @homework.student_works.find_or_create_by(user_id: current_user.id)
|
|
|
|
|
|
|
|
|
|