diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index ef3d683b7..b11bf0dc5 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -78,7 +78,15 @@ class HomeworkAttachController < ApplicationController if bid.homeworks.where("user_id = ?",User.current).count == 0 user_id = params[:user_id] bid_id = params[:bid_id] - project_id = params[:new_form][:project_id] + if params[:homework_attach] + if params[:homework_attach][:project_id] + project_id = params[:homework_attach][:project_id] + else + project_id = 0 + end + else + project_id = 0 + end sta = 0 name = params[:new_form][:name] description = params[:new_form][:description] @@ -180,7 +188,15 @@ class HomeworkAttachController < ApplicationController if User.current.admin? || User.current.member_of?(course) name = params[:homework_name] description = params[:homework_description] - project_id = params[:homework_attach][:project_id] + if params[:homework_attach] + if params[:homework_attach][:project_id] + project_id = params[:homework_attach][:project_id] + else + project_id = 0 + end + else + project_id = 0 + end @homework.name = name @homework.description = description @homework.project_id = project_id diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb index 96ea4e28c..90bbe101b 100644 --- a/app/helpers/courses_helper.rb +++ b/app/helpers/courses_helper.rb @@ -186,7 +186,11 @@ module CoursesHelper #获取指定作业的最终评分 #最终评分 = 学生评分的平均分 * 0.4 +教师评分 * 0.6 def score_for_homework homework - return format("%.2f",(teacher_score_for_homework(homework).to_f * 0.6 + student_score_for_homework(homework).to_f * 0.4)) + if homework.bid.is_evaluation == 1 || homework.bid.is_evaluation == nil + return format("%.2f",(teacher_score_for_homework(homework).to_f * 0.6 + student_score_for_homework(homework).to_f * 0.4)) + else + return teacher_score_for_homework homework + end end #获取作业的互评得分 diff --git a/app/views/bids/_homework_list.html.erb b/app/views/bids/_homework_list.html.erb index e1ca9e0fd..b52ac6933 100644 --- a/app/views/bids/_homework_list.html.erb +++ b/app/views/bids/_homework_list.html.erb @@ -114,7 +114,7 @@ 提交文件:  - <% if is_evaluation %> + <% if is_evaluation || is_teacher%> <%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%> <% else %> 未开启互评功能作业不允许下载