|
|
|
@ -168,6 +168,7 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
|
|
|
|
|
def create
|
|
|
|
|
if params[:student_work]
|
|
|
|
|
@submit_result = true
|
|
|
|
|
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
|
|
|
|
|
student_work ||= StudentWork.new
|
|
|
|
|
student_work.name = params[:student_work][:name]
|
|
|
|
@ -183,7 +184,6 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
else
|
|
|
|
|
student_work.late_penalty = 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if student_work.save
|
|
|
|
|
course_activity = CourseActivity.where("course_act_type='HomeworkCommon' and course_act_id =#{@homework.id}").first
|
|
|
|
|
if course_activity
|
|
|
|
@ -198,21 +198,13 @@ class StudentWorkController < ApplicationController
|
|
|
|
|
@student_work = StudentWork.where(homework_common_id: @homework.id, user_id: User.current.id).first
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.js
|
|
|
|
|
=begin
|
|
|
|
|
format.html {
|
|
|
|
|
flash[:notice] = l(:notice_successful_create)
|
|
|
|
|
redirect_to student_work_index_url(:homework => @homework.id)
|
|
|
|
|
}
|
|
|
|
|
=end
|
|
|
|
|
end
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
@submit_result = false
|
|
|
|
|
respond_to do |format|
|
|
|
|
|
format.html {
|
|
|
|
|
flash[:notice] = l(:notice_failed_create)
|
|
|
|
|
redirect_to new_student_work_url(:homework => @homework.id)
|
|
|
|
|
}
|
|
|
|
|
format.js
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|