1.修复未开启互评功能作业总评得分计算不正确的问题

2.修复未选择项目新建、修改有误的BUG
This commit is contained in:
sw 2014-06-19 17:49:18 +08:00
parent e43a84ab4b
commit 463edeee71
3 changed files with 24 additions and 4 deletions

View File

@ -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

View File

@ -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
#获取作业的互评得分

View File

@ -114,7 +114,7 @@
<tr>
<td>
<strong>提交文件:&nbsp;
<% if is_evaluation %>
<% if is_evaluation || is_teacher%>
<%= link_to "打包下载", :controller => "zipdown", :action => "download_user_homework",:homework => homework%>
<% else %>
<span class="required">未开启互评功能作业不允许下载</span>