|
|
@ -92,6 +92,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
student_work.commit_time = Time.now
|
|
|
|
student_work.commit_time = Time.now
|
|
|
|
student_work.update_time = Time.now
|
|
|
|
student_work.update_time = Time.now
|
|
|
|
student_work.commit_user_id = current_user.id
|
|
|
|
student_work.commit_user_id = current_user.id
|
|
|
|
|
|
|
|
student_work.update_user_id = current_user.id
|
|
|
|
student_work.group_id = @homework.homework_type == "group" ? @homework.max_group_id : 0
|
|
|
|
student_work.group_id = @homework.homework_type == "group" ? @homework.max_group_id : 0
|
|
|
|
|
|
|
|
|
|
|
|
#提交作品时,计算是否迟交
|
|
|
|
#提交作品时,计算是否迟交
|
|
|
@ -112,7 +113,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
homework_common_id: @homework.id, project_id: student_work.project_id,
|
|
|
|
homework_common_id: @homework.id, project_id: student_work.project_id,
|
|
|
|
late_penalty: student_work.late_penalty, work_status: student_work.work_status,
|
|
|
|
late_penalty: student_work.late_penalty, work_status: student_work.work_status,
|
|
|
|
commit_time: Time.now, update_time: Time.now, group_id: student_work.group_id,
|
|
|
|
commit_time: Time.now, update_time: Time.now, group_id: student_work.group_id,
|
|
|
|
commit_user_id: current_user.id)
|
|
|
|
commit_user_id: current_user.id, update_user_id: current_user.id)
|
|
|
|
stu_work.save!
|
|
|
|
stu_work.save!
|
|
|
|
student_work.attachments.each do |attachment|
|
|
|
|
student_work.attachments.each do |attachment|
|
|
|
|
att = attachment.copy
|
|
|
|
att = attachment.copy
|
|
|
@ -156,6 +157,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
begin
|
|
|
|
begin
|
|
|
|
@work.description = params[:description]
|
|
|
|
@work.description = params[:description]
|
|
|
|
@work.update_time = Time.now
|
|
|
|
@work.update_time = Time.now
|
|
|
|
|
|
|
|
@work.update_user_id = current_user.id
|
|
|
|
# @work.commit_user_id = current_user.id
|
|
|
|
# @work.commit_user_id = current_user.id
|
|
|
|
if @work.save!
|
|
|
|
if @work.save!
|
|
|
|
Attachment.associate_container(params[:attachment_ids], @work.id, @work.class)
|
|
|
|
Attachment.associate_container(params[:attachment_ids], @work.id, @work.class)
|
|
|
@ -172,7 +174,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
# 原成员更新描述、更新时间以及附件
|
|
|
|
# 原成员更新描述、更新时间以及附件
|
|
|
|
@homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work|
|
|
|
|
@homework.student_works.where(group_id: @work.group_id, user_id: (work_user_ids & params_user_ids)).each do |work|
|
|
|
|
# work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id)
|
|
|
|
# work.update_attributes(update_time: Time.now, description: @work.description, commit_user_id: current_user.id)
|
|
|
|
work.update_attributes(update_time: Time.now, description: @work.description)
|
|
|
|
work.update_attributes(update_time: Time.now, description: @work.description, update_user_id: current_user.id)
|
|
|
|
work.attachments.destroy_all
|
|
|
|
work.attachments.destroy_all
|
|
|
|
@work.attachments.each do |attachment|
|
|
|
|
@work.attachments.each do |attachment|
|
|
|
|
att = attachment.copy
|
|
|
|
att = attachment.copy
|
|
|
@ -192,7 +194,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
@homework.student_works.where(group_id: @work.group_id, user_id: delete_user_ids).
|
|
|
|
@homework.student_works.where(group_id: @work.group_id, user_id: delete_user_ids).
|
|
|
|
update_all(work_status: 0, description: nil, late_penalty: 0, commit_time: nil, update_time: nil,
|
|
|
|
update_all(work_status: 0, description: nil, late_penalty: 0, commit_time: nil, update_time: nil,
|
|
|
|
final_score: nil, teacher_score: nil, student_score: nil, teaching_asistant_score: nil,
|
|
|
|
final_score: nil, teacher_score: nil, student_score: nil, teaching_asistant_score: nil,
|
|
|
|
work_score: nil, project_id: 0, group_id: 0, commit_user_id: nil)
|
|
|
|
work_score: nil, project_id: 0, group_id: 0, commit_user_id: nil, update_user_id: nil)
|
|
|
|
|
|
|
|
|
|
|
|
# 新增加的成员
|
|
|
|
# 新增加的成员
|
|
|
|
(params_user_ids - work_user_ids).each do |user_id|
|
|
|
|
(params_user_ids - work_user_ids).each do |user_id|
|
|
|
@ -200,7 +202,7 @@ class StudentWorksController < ApplicationController
|
|
|
|
stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id,
|
|
|
|
stu_work.update_attributes(user_id: user_id, description: @work.description, homework_common_id: @homework.id,
|
|
|
|
project_id: @work.project_id, late_penalty: @work.late_penalty,
|
|
|
|
project_id: @work.project_id, late_penalty: @work.late_penalty,
|
|
|
|
work_status: @work.work_status, commit_time: Time.now, update_time: Time.now,
|
|
|
|
work_status: @work.work_status, commit_time: Time.now, update_time: Time.now,
|
|
|
|
group_id: @work.group_id, commit_user_id: @work.commit_user_id)
|
|
|
|
group_id: @work.group_id, commit_user_id: @work.commit_user_id, update_user_id: current_user.id)
|
|
|
|
@work.attachments.each do |attachment|
|
|
|
|
@work.attachments.each do |attachment|
|
|
|
|
att = attachment.copy
|
|
|
|
att = attachment.copy
|
|
|
|
att.author_id = attachment.author_id
|
|
|
|
att.author_id = attachment.author_id
|
|
|
|