Merge branch 'cxt_course' into develop

Conflicts:
	db/schema.rb
This commit is contained in:
cxt 2016-07-08 13:18:46 +08:00
commit cc4b24cdb9
22 changed files with 680 additions and 205 deletions

View File

@ -178,7 +178,7 @@ class HomeworkCommonController < ApplicationController
@statue = 4 and return unless User.current.admin? || User.current.allowed_to?(:as_teacher,@course)
@statue = 5 and return if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
if @homework_detail_manual.comment_status == 1
student_works = @homework.student_works
student_works = @homework.student_works.has_committed
if student_works && student_works.size >= 2
if @homework.homework_type == 3
student_work_projects = @homework.student_work_projects.where("student_work_id is not null")
@ -232,8 +232,8 @@ class HomeworkCommonController < ApplicationController
@homework_detail_manual.update_column('comment_status', 3)
@homework_detail_manual.update_column('evaluation_end', Date.today)
#计算缺评扣分
work_ids = "(" + @homework.student_works.map(&:id).join(",") + ")"
@homework.student_works.each do |student_work|
work_ids = "(" + @homework.student_works.has_committed.map(&:id).join(",") + ")"
@homework.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * @homework_detail_manual.absence_penalty : 0
student_work.save
@ -263,11 +263,11 @@ class HomeworkCommonController < ApplicationController
@totle_size = 0
if @homework_detail_manual.comment_status == 1
@totle_size = @course.student.count
@cur_size = @homework.student_works.size
@cur_size = @homework.student_works.has_committed.size
elsif @homework_detail_manual.comment_status == 2
@homework.student_works.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
@homework.student_works.has_committed.map { |work| @totle_size += work.student_works_evaluation_distributions.count}
@cur_size = 0
@homework.student_works.map { |work| @cur_size += work.student_works_scores.where(:reviewer_role => 3).count}
@homework.student_works.has_committed.map { |work| @cur_size += work.student_works_scores.select("distinct user_id").where(:reviewer_role => 3).count}
end
@percent = format("%.2f",(@cur_size.to_f / ( @totle_size == 0 ? 1 : @totle_size)) * 100)
@user_activity_id = params[:user_activity_id].to_i

View File

@ -390,7 +390,7 @@ class StudentWorkController < ApplicationController
student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')'
end
#开放作品 || 老师 || 超级管理员 || 禁用匿评&&作业截止&&已提交作品 显示所有列表
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
if (@homework.is_open == 1 && @course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@ -409,7 +409,7 @@ class StudentWorkController < ApplicationController
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
end
else
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
@stundet_works = @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3
@ -420,7 +420,7 @@ class StudentWorkController < ApplicationController
my_work = @homework.student_works.where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.where(:user_id => User.current.id)
my_work = @homework.student_works.has_committed.where(:user_id => User.current.id)
end
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
@ -432,17 +432,17 @@ class StudentWorkController < ApplicationController
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
my_work = @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
end
if my_work.empty?
@stundet_works = []
else
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
@stundet_works = search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
@stundet_works = search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
else
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
@stundet_works = search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name
end
@show_all = true
end
@ -454,9 +454,9 @@ class StudentWorkController < ApplicationController
return
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
@student_work_count = (search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name).count
else
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.where(:user_id => User.current.id).empty?)
if (@homework.is_open == 1 &&@course.is_public == 1) || (@homework.is_open == 1 && @course.is_public == 0 && User.current.member_of_course?(@course)) || @is_teacher || User.current.admin? || (User.current.member_of_course?(@course) && @homework.anonymous_comment == 1 && Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d") && !@homework.student_works.has_committed.where(:user_id => User.current.id).empty?)
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@ -475,7 +475,7 @@ class StudentWorkController < ApplicationController
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
end
else
@stundet_works = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
@stundet_works = @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
end
elsif @homework.homework_detail_manual.comment_status == 2 #学生 && 开启匿评 看到匿评列表
if @homework.homework_type == 3
@ -486,7 +486,7 @@ class StudentWorkController < ApplicationController
my_work = @homework.student_works.where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.where(:user_id => User.current.id)
my_work = @homework.student_works.has_committed.where(:user_id => User.current.id)
end
@stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id}
elsif @homework.homework_detail_manual.comment_status == 3 #学生 && 关闭匿评 未提交作品之前列表为空,提交了作品看到所有的
@ -498,17 +498,17 @@ class StudentWorkController < ApplicationController
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:id => pro.student_work_id)
end
else
my_work = @homework.student_works.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
my_work = @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").where(:user_id => User.current.id)
end
if my_work.empty?
@stundet_works = []
else
if @order == 'lastname'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
@stundet_works = search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins(:user).order("CONVERT(lastname USING gbk) COLLATE gbk_chinese_ci #{@b_sort}, login #{@b_sort}"),@name
elsif @order == 'student_id'
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
@stundet_works = search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").joins("join user_extensions on student_works.user_id = user_extensions.user_id").order("#{@order} #{@b_sort}"),@name
else
@stundet_works = search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name
@stundet_works = search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name
end
@show_all = true
end
@ -519,7 +519,7 @@ class StudentWorkController < ApplicationController
render_403
return
end
@student_work_count = (search_homework_member @homework.student_works.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name).count
@student_work_count = (search_homework_member @homework.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("#{@order} #{@b_sort}"),@name).count
end
@score = @b_sort == "desc" ? "asc" : "desc"
@ -547,10 +547,10 @@ class StudentWorkController < ApplicationController
return
end
@user = User.current
@student_work = @homework.student_works.where("user_id = ?",User.current.id).first
if @student_work.nil?
#@student_work = @homework.student_works.where("user_id = ?",User.current.id).first
#if @student_work.nil?
@student_work = StudentWork.new
end
#end
respond_to do |format|
format.html{ render :layout => "new_base_user"}
end
@ -560,7 +560,7 @@ class StudentWorkController < ApplicationController
# 提交作品前先判断是否已经提交
@has_commit = false;
if hsd_committed_work?(User.current.id, @homework.id)
@work = StudentWork.where("user_id =? and homework_common_id =?", User.current.id, @homework.id).first
@work = StudentWork.where("user_id =? and homework_common_id =? and work_status != 0", User.current.id, @homework.id).first
@has_commit = true;
#flash[:notice] = l(:notice_successful_create)
#redirect_to edit_student_work_url(params[:student_work])
@ -572,6 +572,7 @@ class StudentWorkController < ApplicationController
if params[:student_work]
@submit_result = true
student_work = StudentWork.find(params[:student_work_id]) if params[:student_work_id]
student_work = StudentWork.where("user_id =? and homework_common_id =? and work_status = 0", User.current.id, @homework.id).first
student_work ||= StudentWork.new
student_work.name = params[:student_work][:name] == "#{@homework.name}的作品提交(可修改)" ? "#{@homework.name}的作品提交" : params[:student_work][:name]
student_work.description = params[:student_work][:description]
@ -586,8 +587,10 @@ class StudentWorkController < ApplicationController
#提交作品时,计算是否迟交
if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
student_work.late_penalty = @homework.late_penalty
student_work.work_status = 2
else
student_work.late_penalty = 0
student_work.work_status = 1
end
if student_work.save
if @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1
@ -810,6 +813,7 @@ class StudentWorkController < ApplicationController
if @is_teacher
@is_new = true
@is_last_a = false
@work.update_column('work_status', 1)
else
@is_new = false
end
@ -1148,7 +1152,7 @@ class StudentWorkController < ApplicationController
end
def hsd_committed_work?(user, homework)
sw = StudentWork.where("user_id =? and homework_common_id =?", user, homework).first
sw = StudentWork.where("user_id =? and homework_common_id =? and work_status != 0", user, homework).first
sw.nil? ? result = false : result = true
result
end

View File

@ -950,8 +950,10 @@ class UsersController < ApplicationController
#提交作品时,计算是否迟交
if Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(Time.now.to_s).strftime("%Y-%m-%d")
student_work.late_penalty = homework.late_penalty
student_work.work_status = 2
else
student_work.late_penalty = 0
student_work.work_status = 1
end
student_work.save
@ -1042,6 +1044,16 @@ class UsersController < ApplicationController
homework_detail_manual.save if homework_detail_manual
homework_detail_programing.save if homework_detail_programing
homework_detail_group.save if homework_detail_group
if homework.homework_type != 3
unless homework.course.nil?
name = homework.name
homework.course.student.each do |student|
StudentWork.create(:name => "#{name}的作品提交", :homework_common_id => homework.id, :user_id => student.student_id)
end
end
end
if params[:quotes] && !params[:quotes].blank?
quotes_homework = HomeworkCommon.find params[:quotes].to_i
quotes_homework.update_column(:quotes, quotes_homework.quotes+1)

View File

@ -2682,39 +2682,40 @@ module ApplicationHelper
#根据传入作业确定显示为编辑作品还是新建作品,或者显示作品数量
def user_for_homework_common homework,is_teacher
if User.current.member_of_course?(homework.course)
count = homework.student_works.has_committed.count
if is_teacher #老师显示作品数量
link_to "作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
link_to "作品(#{count})", student_work_index_url_in_org(homework.id), :class => "c_blue"
else #学生显示提交作品、修改作品等按钮
work = cur_user_works_for_homework homework
project = cur_user_projects_for_homework homework
if work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "提交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
link_to "提交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再提交作品'
else
link_to "提交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
link_to "提交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
end
elsif work.nil? && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") < Time.now.strftime("%Y-%m-%d")
if homework.homework_type ==3 && project.nil? && homework.homework_detail_group.base_on_project == 1
link_to "补交作品(#{homework.student_works.count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
link_to "补交作品(#{count})","javascript:void(0)", :class => 'c_grey',:style=>"cursor:not-allowed",:title => '请先关联项目再补交作品'
else
link_to "补交作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
link_to "补交作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_red'
end
else
if homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 2 #匿评作业,且作业状态不是在开启匿评之前
link_to "作品匿评", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "开启匿评后不可修改作品"
elsif homework.homework_detail_manual && homework.homework_detail_manual.comment_status == 3
link_to "查看作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
link_to "查看作品(#{count})",student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "匿评已结束"
elsif homework.homework_type == 2 && Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d")#编程作业不能修改作品
link_to "修改作品(#{homework.student_works.count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
link_to "修改作品(#{count})", new_student_work_url_without_domain(homework.id),:class => 'c_blue'
elsif Time.parse(homework.end_time.to_s).strftime("%Y-%m-%d") >= Time.now.strftime("%Y-%m-%d") && work.user_id == User.current.id
link_to "修改作品(#{homework.student_works.count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
link_to "修改作品(#{count})", edit_student_work_url_without_domain(work.id),:class => 'c_blue'
else
link_to "查看作品(#{homework.student_works.count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
link_to "查看作品(#{count})", student_work_index_url_in_org(homework.id), :class => 'c_blue', :title => "作业截止后不可修改作品"
end
end
end
else
link_to "作品(#{homework.student_works.count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
link_to "作品(#{count})",student_work_index_url_in_org(homework.id),:class => "c_blue"
end
end
@ -2752,7 +2753,7 @@ module ApplicationHelper
#获取当前用户在指定作业下提交的作业的集合
def cur_user_works_for_homework homework
work = homework.student_works.where("user_id = ?",User.current).first
work = homework.student_works.where("user_id = ? && work_status != 0",User.current).first
if homework.homework_type == 3
pro = homework.student_work_projects.where("user_id = #{User.current.id}").first
if pro.nil? || pro.student_work_id == "" || pro.student_work_id.nil?
@ -3339,4 +3340,4 @@ def course_syllabus_option user = User.current
end
end
type
end
end

View File

@ -52,6 +52,19 @@ module StudentWorkHelper
result
end
def get_status status
str = ""
case status
when 0
str = "未提交"
when 1
str = "已提交"
when 2
str = "迟交"
end
str
end
#获取赞的总数
def praise_homework_count obj_id
PraiseTread.where("praise_tread_object_id = #{obj_id} AND praise_tread_object_type = 'StudentWork'").count

View File

@ -13,6 +13,8 @@ class StudentWork < ActiveRecord::Base
has_many :course_messages, :class_name =>'CourseMessage', :as => :course_message, :dependent => :destroy
has_many :attachments, :dependent => :destroy
scope :has_committed, lambda{where("work_status != 0")}
before_destroy :delete_praise
before_save :set_program_score, :set_src
@ -172,7 +174,7 @@ class StudentWork < ActiveRecord::Base
# status == 0 : delay
def act_as_message
if self.created_at > self.homework_common.end_time + 1
if self.work_status != 0 && self.created_at > self.homework_common.end_time + 1
self.course_messages << CourseMessage.new(:user_id => self.user_id, :course_id => self.homework_common.course_id, :viewed => false, :status => false)
end
end

View File

@ -1,32 +1,31 @@
<table class="hwork-table-wrap" id="homework_table">
<tr class="b_grey hworkH30">
<th class="hworkList30 hworkH30 pl5 pr5">序号</th>
<th class="hworkList40 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<% if @homework.homework_type != 3 %>
<th class="<%= @homework.homework_type == 2 ? 'hworkList210' : 'hworkList260' %> hide-text" style="text-align:left;">作品名称</th>
<th class="hworkList80 hide-text">
<th class="<%= @homework.homework_type == 2 ? 'hworkList160' : 'hworkList200' %> hide-text">
<span class="HomeworkStuTitle f14 fb">姓名</span>
</th>
<th class="hworkList80 hide-text">
<th class="<%= @homework.homework_type == 2 ? 'hworkList160' : 'hworkList190' %> hide-text">
<span class="HomeworkStuTitle f14 fb">学号</span>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<th class="hworkList260" style="text-align:left;">作品名称</th>
<th class="hworkList230" style="text-align:left;">组长</th>
<th class="hworkList160">
<span class="HomeworkStuTitle f14 fb fl">关联项目</span>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<th class="hworkList420" style="text-align:left;">作品名称</th>
<th class="hworkList390" style="text-align:left;">组长</th>
<% end %>
<th class="hworkList130 pl10">
时间
状态
</th>
<% if @homework.homework_type == 2%>
<th class="hworkList50">
<th class="hworkList70">
系统
</th>
<% end%>
<th class="hworkList50 pr10 pl10" style="font-size:12px;">
<th class="hworkList70 pr10 pl10" style="font-size:12px;">
我的评分
</th>
</tr>

View File

@ -0,0 +1,48 @@
<tr class="b_grey hworkH30">
<th class="hworkList40 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList130' : 'hworkList100' %> pl5 pr5 hide-text">
<%= link_to "姓名", @show_all ? student_work_index_path(:homework => @homework.id, :order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "lastname" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "lastname", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList130' : 'hworkList90' %> pl5 pr5 hide-text">
<%= link_to "学号", @show_all ? student_work_index_path(:homework => @homework.id, :order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "student_id" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "student_id", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList130">
<%= link_to "时间", @show_all ? student_work_index_path(:homework => @homework.id, :order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "created_at" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "created_at", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList70">
<%= link_to "教师", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teacher_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList70">
<%= link_to "教辅", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teaching_asistant_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% if @homework.anonymous_comment == 0 %>
<th class="hworkList70">
<%= link_to "匿评", @show_all ? student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "student_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% end %>
<th class="hworkList70">
<%= link_to "成绩", @show_all ? student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
</tr>

View File

@ -0,0 +1,79 @@
<tr class="hworkListRow" id="student_work_<%= student_work.id %>">
<td class="none"><a name="<%= student_work.id %>"></a></td>
<td class="hworkList40 pl5 pr5" id="work_num_<%= student_work.id %>"><%= index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= link_to(image_tag(url_to_avatar(student_work.user), :width => "40", :height => "40", :style => "display:block;"), user_activities_path(student_work.user)) %>
</td>
<td class="<%= @homework.anonymous_comment == 1 ? 'hworkStName130' : 'hworkStName100' %> pr10 float-none student_work_<%= student_work.id %>" title="<%= student_work.user.show_name %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.show_name %>
</td>
<td class="<%= @homework.anonymous_comment == 1 ? 'hworkStName130' : 'hworkStID90' %> pr10 float-none student_work_<%= student_work.id %>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
</td>
<td class="hworkList130 c_grey student_work_<%= student_work.id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.created_at && @homework.end_time %>
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M") %>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>
<% end %>
<% end %>
</td>
<td class="hworkList70 <%= score_color student_work.teacher_score %>">
<%= student_work.teacher_score.nil? ? "--" : format("%.1f", student_work.teacher_score) %>
</td>
<td class="hworkList70 <%= score_color student_work.teaching_asistant_score %>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f", student_work.teaching_asistant_score) %>
</td>
<% if @homework.anonymous_comment == 0 %>
<td class="hworkList70 <%= score_color student_work.student_score %> student_score_info">
<% if student_work.student_score.nil? %>
<span title="该作品未被匿评">未参与</span>
<% else %>
<%= format("%.1f", student_work.student_score) %>
<% end %>
<% unless student_work.student_score.nil? %>
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>)
</span>
<div class="infoNi none">
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f", student_work.student_score) %>&nbsp;</span>分。
</div>
<% end %>
</td>
<% end %>
<!-- 成绩 -->
<% if student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score %>
<% score = student_work.respond_to?("score") ? student_work.score : student_work.teacher_score %>
<% else %>
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty %>
<% end %>
<td class="hworkList70 <%= score_color score %> student_final_scor_info">
<%= score.nil? ? "--" : format("%.1f", score<0 ? 0 : score) %>
<% unless score.nil? %>
<div class="infoNi none width180">
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score %>&nbsp;</span>分。
迟交扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %>
&nbsp;</span>分,
缺评扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty %>
&nbsp;</span>分,
最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f", score<0 ? 0 : score) %>&nbsp;</span>分。
</div>
<% end %>
</td>
<td>
<div style="position:relative;">
<div class="hworkTip" style="display: none" id="work_click_<%= student_work.id %>">
<em></em><span></span><font class="fontGrey2">点击查看详情</font></div>
</div>
</td>
</tr>

View File

@ -0,0 +1,44 @@
<tr class="b_grey hworkH30">
<th class="hworkList40 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<th class="hworkList130 pl5 pr5" style="text-align:left;">组长</th>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList140' : 'hworkList70' %>">
<span class="c_dark f14 fb">关联项目</span>
</th>
<% elsif @homework.homework_detail_group.base_on_project == 0 %>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList270' : 'hworkList200' %> pl5 pr5" style="text-align:left;">组长</th>
<% end %>
<th class="hworkList130">
<%= link_to "时间", @show_all ? student_work_index_path(:homework => @homework.id, :order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "created_at" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "created_at", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList70">
<%= link_to "教师", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teacher_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList70">
<%= link_to "教辅", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teaching_asistant_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% if @homework.anonymous_comment == 0 %>
<th class="hworkList70">
<%= link_to "匿评", @show_all ? student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "student_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% end %>
<th class="hworkList70">
<%= link_to "成绩", @show_all ? student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
</tr>

View File

@ -0,0 +1,89 @@
<tr class="hworkListRow" id="student_work_<%= student_work.id%>">
<td class="none"><a name="<%= student_work.id%>"></a></td>
<td class="hworkList40 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %>
</td>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> width130" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<div>
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</td>
<% else %>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="该项目是私有的">
<%= student_work.project.name %>
</td>
<% end %>
<% elsif @homework.homework_detail_group.base_on_project == 0 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%=@homework.anonymous_comment == 1 ? 'width280' : 'width210' %>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<div>
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% end %>
<td class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.created_at && @homework.end_time%>
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>
<% end %>
<% end %>
</td>
<td class="hworkList70 <%= score_color student_work.teacher_score%>">
<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
</td>
<td class="hworkList70 <%= score_color student_work.teaching_asistant_score%>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
</td>
<% if @homework.anonymous_comment == 0%>
<td class="hworkList70 <%= score_color student_work.student_score%> student_score_info">
<% if student_work.student_score.nil? %>
<span title="该作品未被匿评">未参与</span>
<% else %>
<%=format("%.1f",student_work.student_score) %>
<% end %>
<% unless student_work.student_score.nil?%>
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>)
</span>
<div class="infoNi none">
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count%>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.student_score)%>&nbsp;</span>分。
</div>
<% end%>
</td>
<% end %>
<!-- 成绩 -->
<% if student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score %>
<% score = student_work.respond_to?("score") ? student_work.score : student_work.teacher_score %>
<% else %>
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
<% end %>
<td class="hworkList70 <%= score_color score%> student_final_scor_info">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="infoNi none width180">
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score%>&nbsp;</span>分。
迟交扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %>
&nbsp;</span>分,
缺评扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty%>
&nbsp;</span>分,
最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f",score<0 ? 0 : score)%>&nbsp;</span>分。
</div>
<% end%>
</td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr>

View File

@ -0,0 +1,55 @@
<tr class="b_grey hworkH30">
<th class="hworkList40 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList110' : 'hworkList60' %> pl5 pr5 hide-text">
<%= link_to "姓名", @show_all ? student_work_index_path(:homework => @homework.id, :order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "lastname" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "lastname", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList80' %> pl5 pr5 hide-text">
<%= link_to "学号", @show_all ? student_work_index_path(:homework => @homework.id, :order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "student_id" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "student_id", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList110">
<%= link_to "时间", @show_all ? student_work_index_path(:homework => @homework.id, :order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "created_at" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "created_at", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList70">
<%= link_to "教师", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teacher_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList70">
<%= link_to "教辅", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teaching_asistant_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="hworkList70">
<%= link_to "系统", @show_all ? student_work_index_path(:homework => @homework.id, :order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "system_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "system_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% if @homework.anonymous_comment == 0 %>
<th class="hworkList70">
<%= link_to "匿评", @show_all ? student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "student_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% end %>
<th class="hworkList70">
<%= link_to "成绩", @show_all ? student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
</tr>

View File

@ -0,0 +1,83 @@
<tr class="hworkListRow" id="student_work_<%= student_work.id %>">
<td class="none"><a name="<%= student_work.id %>"></a></td>
<td class="hworkList40 pl5 pr5" id="work_num_<%= student_work.id %>"><%= index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= link_to(image_tag(url_to_avatar(student_work.user), :width => "40", :height => "40", :style => "display:block;"), user_activities_path(student_work.user)) %>
</td>
<td class="<%= @homework.anonymous_comment == 1 ? 'hworkStName110' : 'hworkStName' %> pr10 float-none student_work_<%= student_work.id %>" title="<%= student_work.user.show_name %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.show_name %>
</td>
<td class="<%= @homework.anonymous_comment == 1 ? 'hworkStID100' : 'hworkStID' %> pr10 float-none student_work_<%= student_work.id %>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id %>
</td>
<td class="hworkList110 c_grey student_work_<%= student_work.id %>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.created_at && @homework.end_time %>
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M") %>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>
<% end %>
<% end %>
</td>
<td class="hworkList70 <%= score_color student_work.teacher_score %>">
<%= student_work.teacher_score.nil? ? "--" : format("%.1f", student_work.teacher_score) %>
</td>
<td class="hworkList70 <%= score_color student_work.teaching_asistant_score %>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f", student_work.teaching_asistant_score) %>
</td>
<!-- 系统评分 -->
<td class="hworkList70 <%= score_color student_work.system_score %>">
<%= student_work.system_score.nil? ? "--" : format("%.1f", student_work.system_score) %>
</td>
<% if @homework.anonymous_comment == 0 %>
<td class="hworkList70 <%= score_color student_work.student_score %> student_score_info">
<% if student_work.student_score.nil? %>
<span title="该作品未被匿评">未参与</span>
<% else %>
<%= format("%.1f", student_work.student_score) %>
<% end %>
<% unless student_work.student_score.nil? %>
<span class="linkBlue">
(<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>)
</span>
<div class="infoNi none">
现共有
<span class="c_red">&nbsp;<%= student_work.student_works_scores.where(:reviewer_role => 3).group_by(&:user_id).count %>&nbsp;</span>
名学生进行了匿评,平均分为
<span class="c_red">&nbsp;<%= format("%.1f", student_work.student_score) %>&nbsp;</span>分。
</div>
<% end %>
</td>
<% end %>
<!-- 成绩 -->
<% if student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score %>
<% score = student_work.respond_to?("score") ? student_work.score : student_work.teacher_score %>
<% else %>
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty %>
<% end %>
<td class="hworkList70 <%= score_color score %> student_final_scor_info">
<%= score.nil? ? "--" : format("%.1f", score<0 ? 0 : score) %>
<% unless score.nil? %>
<div class="infoNi none width180">
作品最终评分为
<span class="c_red">&nbsp;<%= student_work.final_score %>&nbsp;</span>分。
迟交扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.late_penalty %>
&nbsp;</span>分,
缺评扣分
<span class="c_red">&nbsp;
<%= student_work.homework_common && student_work.homework_common.teacher_priority == 1 && student_work.teacher_score ? 0 : student_work.absence_penalty %>
&nbsp;</span>分,
最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f", score<0 ? 0 : score) %>&nbsp;</span>分。
</div>
<% end %>
</td>
<td>
<div style="position:relative;">
<div class="hworkTip" style="display: none" id="work_click_<%= student_work.id %>">
<em></em><span></span><font class="fontGrey2">点击查看详情</font></div>
</div>
</td>
</tr>

View File

@ -1,77 +1,86 @@
<table class="hwork-table-wrap" id="homework_table">
<tr class="b_grey hworkH30">
<th class="hworkList30 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<% if @homework.homework_type != 3 %>
<th class="<%= @homework.homework_type == 2 ? 'hworkList80 pl5 pr5 hide-text' : 'hworkList130 pl5 pr5 hide-text'%>" style="text-align:left;">作品名称</th>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList60'%> pl5 pr5 hide-text">
<%= link_to "姓名",@show_all ? student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb" ,:remote => true%>
<% if @show_all && @order == "lastname"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "lastname", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none" ,:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
</th>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList90' : 'hworkList80'%> pl5 pr5 hide-text">
<%= link_to "学号",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb" ,:remote => true%>
<% if @show_all && @order == "student_id"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_id", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none" ,:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<th class="hworkList130 pl5 pr5" style="text-align:left;">作品名称</th>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList210' : 'hworkList160'%>">
<span class="c_dark f14 fb">关联项目</span>
<%# if @homework.homework_type == 1 %>
<%#= render :partial => 'evaluation_un_common_title' %>
<%# elsif @homework.homework_type == 2 %>
<%#= render :partial => 'evaluation_un_pro_title' %>
<%# elsif @homework.homework_type == 3 %>
<%#= render :partial => 'evaluation_un_group_title' %>
<%# else %>
<tr class="b_grey hworkH30">
<th class="hworkList40 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<% if @homework.homework_type != 3 %>
<th class="<%= @homework.homework_type == 1 ? (@homework.anonymous_comment == 1 ? 'hworkList130' : 'hworkList100') : (@homework.anonymous_comment == 1 ? 'hworkList110' : 'hworkList60') %> pl5 pr5 hide-text">
<%= link_to "姓名", @show_all ? student_work_index_path(:homework => @homework.id, :order => "lastname", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "lastname" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "lastname", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<th class="<%= @homework.homework_type == 1 ? (@homework.anonymous_comment == 1 ? 'hworkList130' : 'hworkList90') : (@homework.anonymous_comment == 1 ? 'hworkList100' : 'hworkList80') %> pl5 pr5 hide-text">
<%= link_to "学号", @show_all ? student_work_index_path(:homework => @homework.id, :order => "student_id", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "student_id" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "student_id", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% else %>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<th class="hworkList130 pl5 pr5" style="text-align:left;">组长</th>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList140' : 'hworkList70' %>">
<span class="c_dark f14 fb">关联项目</span>
</th>
<% elsif @homework.homework_detail_group.base_on_project == 0 %>
<th class="<%= @homework.anonymous_comment == 1 ? 'hworkList270' : 'hworkList200' %> pl5 pr5" style="text-align:left;">组长</th>
<% end %>
<% end %>
<th class="<%= @homework.homework_type ==2 ? 'hworkList110' : 'hworkList130' %>">
<%= link_to "状态", @show_all ? student_work_index_path(:homework => @homework.id, :order => "work_status", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "work_status" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "work_status", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<th class="<%=@homework.anonymous_comment == 1 ? 'hworkList340' : 'hworkList290' %> pl5 pr5" style="text-align:left;">作品名称</th>
<% end %>
<th class="hworkList130">
<%= link_to "时间",@show_all ? student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb" ,:remote => true%>
<% if @show_all && @order == "created_at"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "created_at", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none",:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
</th>
<th class="hworkList50">
<%= link_to "教师",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb" ,:remote => true%>
<% if @show_all && @order == "teacher_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teacher_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none" ,:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
</th>
<th class="hworkList50">
<%= link_to "教辅",@show_all ? student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb",:remote => true%>
<% if @show_all && @order == "teaching_asistant_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none",:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
</th>
<% if @homework.homework_type == 2%>
<th class="hworkList50">
<%= link_to "系统",@show_all ? student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb",:remote => true%>
<% if @show_all && @order == "system_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "system_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none",:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
<th class="hworkList70">
<%= link_to "教师", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teacher_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teacher_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% end%>
<% if @homework.anonymous_comment == 0%>
<th class="hworkList50">
<%= link_to "匿评",@show_all ? student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb",:remote => true%>
<% if @show_all && @order == "student_score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "student_score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none",:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
<th class="hworkList70">
<%= link_to "教辅", @show_all ? student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "teaching_asistant_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "teaching_asistant_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% end %>
<th class="hworkList50">
<%= link_to "成绩",@show_all ? student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)",:class => "c_dark f14 fb",:remote => true%>
<% if @show_all && @order == "score"%>
<%= link_to "", student_work_index_path(:homework => @homework.id,:order => "score", :sort => @score, :name => @name, :group => @group) ,:class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none",:style => "line-height:30px; vertical-align:middle;",:remote => true%>
<% end%>
</th>
</tr>
<% @stundet_works.each_with_index do |student_work, i|%>
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work, :index => i}%>
<% if @homework.homework_type == 2 %>
<th class="hworkList70">
<%= link_to "系统", @show_all ? student_work_index_path(:homework => @homework.id, :order => "system_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "system_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "system_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% end %>
<% if @homework.anonymous_comment == 0 %>
<th class="hworkList70">
<%= link_to "匿评", @show_all ? student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "student_score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "student_score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
<% end %>
<th class="hworkList70">
<%= link_to "成绩", @show_all ? student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group) : "javascript:void(0)", :class => "c_dark f14 fb", :remote => true %>
<% if @show_all && @order == "score" %>
<%= link_to "", student_work_index_path(:homework => @homework.id, :order => "score", :sort => @score, :name => @name, :group => @group), :class => "#{@score == 'desc' ? 'sort_up' : 'sort_down'} float-none", :style => "line-height:30px; vertical-align:middle;", :remote => true %>
<% end %>
</th>
</tr>
<%# end %>
<% @stundet_works.each_with_index do |student_work, i| %>
<%= render :partial => "evaluation_un_work", :locals => {:student_work => student_work, :index => i} %>
<tr>
<td colspan="12">
<div id="about_hwork_<%= student_work.id%>">
<div id="about_hwork_<%= student_work.id %>">
</div>
</td>
</tr>
<% end%>
<% end %>
</table>

View File

@ -1,71 +1,69 @@
<!-- 匿评作品列表,显示某一个作品的信息 -->
<%# if @homework.homework_type == 1 %>
<%#= render :partial => 'evaluation_un_common_work', :locals => {:student_work => student_work, :index => index} %>
<%# elsif @homework.homework_type == 2 %>
<%#= render :partial => 'evaluation_un_pro_work', :locals => {:student_work => student_work, :index => index} %>
<%# elsif @homework.homework_type == 3 %>
<%#= render :partial => 'evaluation_un_group_work', :locals => {:student_work => student_work, :index => index} %>
<%# else %>
<tr class="hworkListRow" id="student_work_<%= student_work.id%>">
<td class="none"><a name="<%= student_work.id%>"></a></td>
<td class="hworkList30 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkList40 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_activities_path(student_work.user)) %>
</td>
<% if @homework.homework_type != 3 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%= @homework.homework_type == 2 ? '' : 'width130'%>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkStName100' : 'hworkStName'%> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<td class="<%= @homework.homework_type == 1 ? (@homework.anonymous_comment == 1 ? 'hworkStName130' : 'hworkStName100') : (@homework.anonymous_comment == 1 ? 'hworkStName110' : 'hworkStName') %> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.show_name%>
</td>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkStID90' : 'hworkStID'%> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<td class="<%= @homework.homework_type == 1 ? (@homework.anonymous_comment == 1 ? 'hworkStName130' : 'hworkStID90') : (@homework.anonymous_comment == 1 ? 'hworkStID100' : 'hworkStID') %> pr10 float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor:pointer;">
<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>
</td>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> width130" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</td>
<% else %>
<td class="hworkPrName student_work_<%= student_work.id%>" title="该项目是私有的">
<%= student_work.project.name %>
</td>
<% end %>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%=@homework.anonymous_comment == 1 ? 'width340' : 'width290' %>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<div>
<%= link_to student_work_name,"javascript:void(0)" ,:title => student_work_name, :class => "linkGrey f14 StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% else %>
<% if @homework.homework_detail_group.base_on_project == 1 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> width130" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<div>
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "StudentName break_word"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="项目名称">
<%= link_to( student_work.project.name, project_path(student_work.project.id))%>
</td>
<% else %>
<td class="<%=@homework.anonymous_comment == 1 ? 'hworkPrName2' : 'hworkPrName'%> student_work_<%= student_work.id%>" title="该项目是私有的">
<%= student_work.project.name %>
</td>
<% end %>
<% elsif @homework.homework_detail_group.base_on_project == 0 %>
<td class="hworkName float-none pr10 student_work_<%= student_work.id%> <%=@homework.anonymous_comment == 1 ? 'width280' : 'width210' %>" style="cursor: pointer;" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<div>
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "StudentName break_word #{@homework.homework_type == 2 ? '' : 'width165'}"%>
</div>
</td>
<% end %>
<% end %>
<td class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.created_at && @homework.end_time%>
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>
<% end %>
<td class="<%= @homework.homework_type ==2 ? 'hworkList110' : 'hworkList130' %> c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
<% end %>
</td>
<td class="hworkList50 <%= score_color student_work.teacher_score%>">
<td class="hworkList70 <%= score_color student_work.teacher_score%>">
<%= student_work.teacher_score.nil? ? "--" : format("%.1f",student_work.teacher_score)%>
</td>
<td class="hworkList50 <%= score_color student_work.teaching_asistant_score%>">
<td class="hworkList70 <%= score_color student_work.teaching_asistant_score%>">
<%= student_work.teaching_asistant_score.nil? ? "--" : format("%.1f",student_work.teaching_asistant_score)%>
</td>
<% if @homework.homework_type == 2%>
<!-- 系统评分 -->
<td class="hworkList50 <%= score_color student_work.system_score%>">
<td class="hworkList70 <%= score_color student_work.system_score%>">
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
</td>
<% end%>
<% if @homework.anonymous_comment == 0%>
<td class="hworkList50 <%= score_color student_work.student_score%> student_score_info">
<td class="hworkList70 <%= score_color student_work.student_score%> student_score_info">
<% if student_work.student_score.nil? %>
<span title="该作品未被匿评">未参与</span>
<% else %>
@ -90,7 +88,7 @@
<% else %>
<% score = student_work.respond_to?("score") ? student_work.score : (student_work.final_score || 0) - student_work.absence_penalty - student_work.late_penalty%>
<% end %>
<td class="hworkList50 <%= score_color score%> student_final_scor_info">
<td class="hworkList70 <%= score_color score%> student_final_scor_info">
<%= score.nil? ? "--" : format("%.1f",score<0 ? 0 : score)%>
<% unless score.nil?%>
<div class="infoNi none width180">
@ -111,6 +109,7 @@
</td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>
</tr>
<%# end %>
<script type="text/javascript">
$(".student_work_<%= student_work.id%>").mouseenter(function(){
if($("#about_hwork_<%= student_work.id%>").html().trim() == "") {

View File

@ -9,28 +9,21 @@
<% end %>
<% if is_my_work%>
<td class="hworkList30 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkList40 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkPortrait pr10 float-none">
<%= image_tag(url_to_avatar(student_work.user),width:"40", height: "40", style: "display:block;") %>
</td>
<% if @homework.homework_type != 3 %>
<td class="hworkName pr10 w250 float-none student_work_<%= student_work.id%>">
<div>
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
</div>
</td>
<td class="hworkStName float-none w80 student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<td class="hworkStName float-none <%= @homework.homework_type == 2 ? 'w180' : 'w190' %> student_work_<%= student_work.id%>" title="<%= student_work.user.show_name%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<%= student_work.user.show_name%>
</td>
<td class="hworkStID float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<span class="hidden fl" style="width:80px;"><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%></span>
<td class="hworkStID <%= @homework.homework_type == 2 ? 'w180' : 'w190' %> float-none student_work_<%= student_work.id%>" title="<%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<span class="hidden"><%= student_work.user.user_extensions.nil? ? "--" : student_work.user.user_extensions.student_id%></span>
</td>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<td class="hworkName pr10 w250 float-none student_work_<%= student_work.id%>">
<td class="hworkName pr10 w220 float-none student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<div>
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word"%>
</div>
</td>
<% if student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? %>
@ -43,53 +36,53 @@
</td>
<% end %>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<td class="hworkName pr10 w410 float-none student_work_<%= student_work.id%>">
<td class="hworkName pr10 w380 float-none student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');">
<div>
<% student_work_name = student_work.name.nil? || student_work.name.empty? ? student_work.user.show_name + '的作品' : student_work.name%>
<%= link_to student_work_name, student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
<%= link_to student_work.user.show_name,"javascript:void(0)" ,:title => student_work.user.show_name, :class => "linkGrey f14 StudentName break_word"%>
</div>
</td>
<% end %>
<% else%>
<td class="hworkList30 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkList40 pl5 pr5" id="work_num_<%=student_work.id %>"><%=index + 1 %></td>
<td class="hworkPortrait float-none pr10">
<%= image_tag(url_to_avatar(""),width:"40", height: "40", style: "display:block;") %>
</td>
<td class="hworkName float-none pr10 w250 student_work_<%= student_work.id%>">
<div>
<%= link_to "匿名的作品", student_work_path(student_work),:remote => true,:title => student_work_name, :class => "linkGrey f14 StudentName break_word w250"%>
</div>
</td>
<% if @homework.homework_type != 3 %>
<td class="hworkStName float-none w80" title="姓名" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<td class="hworkStName float-none <%= @homework.homework_type == 2 ? 'w180' : 'w190' %>" title="姓名" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
匿名
</td>
<td class="hworkStID float-none" title="学号">
<td class="hworkStID <%= @homework.homework_type == 2 ? 'w180' : 'w190' %> float-none" title="学号">
--
</td>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 1 %>
<td class="hworkPrName mr10 float-none" title="项目名称" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<td class="hworkName pr10 w220 float-none student_work_<%= student_work.id%>">
<div style="text-align: left">匿名</div>
</td>
<td class="hworkPrName float-none mr10 student_work_<%= student_work.id%>" title="">
匿名
</td>
<% elsif @homework.homework_type == 3 && @homework.homework_detail_group.base_on_project == 0 %>
<td class="hworkPrName mr10 float-none" title="" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer; text-align: left;">
匿名
</td>
<% end %>
<% end%>
<td class="hworkList130 pl10 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= student_work_path(student_work)%>');" style="cursor: pointer;">
<%= Time.parse(format_time(student_work.created_at)).strftime("%m-%d %H:%M")%>&nbsp;
<% if Time.parse(@homework.end_time.to_s).strftime("%Y-%m-%d") < Time.parse(format_time(student_work.created_at)).strftime("%Y-%m-%d") %>
<span class="c_red">[迟交]</span>
<% if student_work.work_status%>
<%=get_status student_work.work_status %>
<% end %>
</td>
<!-- 成绩 -->
<% if @homework.homework_type == 2%>
<!-- 系统评分 -->
<td class="hworkList50 <%= score_color student_work.system_score%>">
<td class="hworkList70 <%= score_color student_work.system_score%>">
<%= student_work.system_score.nil? ? "--" : format("%.1f",student_work.system_score)%>
</td>
<% end%>
<% my_score = student_work_score(student_work,User.current) %>
<td class="hworkList50 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score)%> mr10 ml10">
<td class="hworkList70 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score)%> mr10 ml10">
<%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
</td>
<td><div style="position:relative;"><div class="hworkTip" style="display: none" id="work_click_<%= student_work.id%>"><em></em><span></span><font class="fontGrey2">点击查看详情</font></div></div></td>

View File

@ -134,8 +134,8 @@
<% end %>
</div>
<div class="cl"></div>
<% if activity.student_works.count != 0 %>
<% sw = activity.student_works.reorder("created_at desc").first %>
<% if activity.student_works.has_committed.count != 0 %>
<% sw = activity.student_works.has_committed.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline mb10">
#&nbsp;<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
@ -156,9 +156,9 @@
<div>
<% if activity.homework_type != 2 %>
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = activity.student_works.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% else %>
<% student_works = activity.student_works.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% student_works = activity.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% end %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">

View File

@ -145,8 +145,8 @@
<% end %>
</div>
<div class="cl"></div>
<% if homework_common.student_works.count != 0 %>
<% sw = homework_common.student_works.reorder("created_at desc").first %>
<% if homework_common.student_works.has_committed.count != 0 %>
<% sw = homework_common.student_works.has_committed.reorder("created_at desc").first %>
<div class="mt10 homepagePostDeadline mb10">
#&nbsp;<%=time_from_now sw.created_at %><%= link_to sw.user.show_name, user_activities_path(sw.user_id), :class => "newsBlue ml5 mr5"%>提交了作品
</div>
@ -167,9 +167,9 @@
<div>
<% if homework_common.homework_type != 2 %>
<% ids = student_work_scores.empty? ? "(-1)" : '('+student_work_scores.map{|sw|sw.student_work_id}.join(',')+')' %>
<% student_works = homework_common.student_works.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% student_works = homework_common.student_works.has_committed.select("student_works.*,student_works.work_score as score").where("student_works.id in #{ids}").order("score desc") %>
<% else %>
<% student_works = homework_common.student_works.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% student_works = homework_common.student_works.has_committed.select("student_works.*,student_works.work_score as score").order("score desc") %>
<% end %>
<% student_works.includes(:user).each_with_index do |sw, i| %>
<div class="fl mr10 w100" style="text-align:center;">

View File

@ -0,0 +1,24 @@
class AddStatusToStudentWork < ActiveRecord::Migration
def change
add_column :student_works, :work_status, :integer, :default => 0
count = HomeworkCommon.all.count / 30 + 2
transaction do
for i in 1 ... count do i
HomeworkCommon.page(i).per(30).each do |hc|
student_works = hc.student_works
end_time = hc.end_time
unless student_works.empty?
student_works.each do |st|
if Time.parse(end_time.to_s).strftime("%Y-%m-%d") < Time.parse(st.created_at.to_s).strftime("%Y-%m-%d")
st.update_column('work_status', 2)
else
st.update_column('work_status', 1)
end
end
end
end
end
end
end
end

View File

@ -12,7 +12,7 @@ namespace :homework_evaluation do
homework_detail_manuals.each do |homework_detail_manual|
homework_common = homework_detail_manual.homework_common
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 1 #新建状态才可开启匿评
student_works = homework_common.student_works
student_works = homework_common.student_works.has_committed
if student_works && student_works.size >= 2
if homework_common.homework_type == 3
student_work_projects = homework_common.student_work_projects.where("student_work_id is not null")
@ -76,8 +76,8 @@ namespace :homework_evaluation do
homework_common = homework_detail_manual.homework_common
if homework_common.anonymous_comment == 0 && homework_detail_manual.comment_status == 2 #开启匿评状态才可关闭匿评
#计算缺评扣分
work_ids = "(" + homework_common.student_works.map(&:id).join(",") + ")"
homework_common.student_works.each do |student_work|
work_ids = "(" + homework_common.student_works.has_committed.map(&:id).join(",") + ")"
homework_common.student_works.has_committed.each do |student_work|
absence_penalty_count = student_work.user.student_works_evaluation_distributions.where("student_work_id IN #{work_ids}").count - student_work.user.student_works_scores.where("student_work_id IN #{work_ids}").count
student_work.absence_penalty = absence_penalty_count > 0 ? absence_penalty_count * homework_detail_manual.absence_penalty : 0
student_work.save

View File

@ -52,25 +52,41 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;}
.hworkTip span {display:block; border-width:8px; position:absolute; bottom:4px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;}
.hworkList340 {width:335px; text-align:left; height:50px; line-height:50px;padding-left:5px;}
.hworkList30 {width:30px; text-align:center;}
.hworkList40 {width:40px; text-align:center;}
.hworkList50 {width:50px; text-align:center;}
.hworkList60 {width:60px; text-align:center;}
.hworkList80 {width:80px; text-align:center;}
.hworkList60 {width:60px; text-align:center;}
.hworkList70 {width:70px; text-align:center;}
.hworkList80 {width:90px; text-align:center;}
.hworkList90 {width:90px; text-align:center;}
.hworkList100 {width:100px; text-align:center;}
.hworkList110 {width:110px; text-align:center;}
.hworkList130 {width:130px; text-align:center;}
.hworkList140 {width:140px; text-align:center;}
.hworkList150 {width:150px; text-align:center;}
.hworkList160 {width:160px; text-align:center;}
.hworkList190 {width:190px; text-align:center;}
.hworkList200 {width:200px; text-align:center;}
.hworkList210 {width:210px; text-align:center;}
.hworkList230 {width:230px; text-align:left;}
.hworkList260 {width:260px; text-align:left;}
.hworkList270 {width:270px; text-align:left;}
.hworkList280 {width:280px; text-align:left;}
.hworkList290 {width:290px; text-align:left;}
.hworkList340 {width:340px; text-align:left;}
.hworkList420 {width:420px; text-align:left;}
.hworkList390 {width:390px; text-align:left;}
.hworkList420 {width:400px; text-align:left;}
.codeList{ float:right; font-size:12px; color:#484848; padding:0px 3px; width:714px; margin-bottom:10px; }
.hworkName {width:80px; float:left; line-height:18px;}
.hworkName div{max-height: 36px;overflow: hidden;}
.hworkStName {width:60px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkStName100 {width:100px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkStName110 {width:110px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkStName130 {width:130px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkStID {width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkStID90 {width:90px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkStID100 {width:100px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkStID130 {width:130px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkDate {max-width:150px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:14px; line-height:14px; font-size:12px; color:#888888;}
.hworkMenu {width:100px; background-color:#ffffff; float:left; list-style:none; position:absolute; border:1px solid #eaeaea; border-radius:5px; top:15px; padding:10px 20px; left:-110px; font-size:12px; color:#888888; display:none; line-height:2; z-index:99;}
a.hworkExport {background:url(../images/homepage_icon2.png) -10px -401px no-repeat; padding-left:23px;}
@ -94,9 +110,11 @@ a.hworkSearchIcon:hover {background:url(../images/nav_icon.png) -49px -1px no-re
.width130{width: 130px;}
.width165{width: 165px;}
.width180{width: 180px;}
.width210{width: 210px;}
.width290{width: 290px;}
.width340{width: 340px;}
.width525{width: 525px;}
.width280{width: 280px;}
.width285{width: 285px;}
.width255{width: 255px;}
.width530{width: 530px;}
@ -1262,8 +1280,8 @@ a:hover.blueCir{ background:#3598db; color:#fff;}
.ml7 {margin-left:7px;}
.tac {text-align:center;}
.proHelp {background:url(/images/course/hwork_icon.png) -5px -124px no-repeat; display:inline-block; width:15px; height:15px; display:inline-block;}
.hworkPrName {width:160px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkPrName2 {width:210px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkPrName {width:80px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.hworkPrName2 {width:150px; overflow:hidden; white-space: nowrap; text-overflow:ellipsis; float:left; height:65px; line-height:65px; vertical-align:middle; font-size:12px; color:#888888; text-align:center;}
.mr150 {margin-right:150px;}
.relatePInfo {text-align: left; position:absolute; background-color:#ffffff; padding:3px 8px; white-space:nowrap; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); z-index:999; color:#585858; cursor:pointer; display:none;}
.captainName {max-width:65px; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; display: inline-block;}

View File

@ -160,7 +160,9 @@ h4{ font-size:14px; }
.w90{ width:90px;}
.w100{width: 100px;}
.w125{width:125px;}
.w180{width:180px;}
.w180{width:180px;!important;}
.w190{width:190px;!important;}
.w220{ width:220px;}
.w210{ width:210px;}
.w150{ width:150px;}
.w170{width:170px;}
@ -173,6 +175,7 @@ h4{ font-size:14px; }
.w270{ width: 270px;}
.w350 {width:350px;}
.w362 {width:362px;}
.w380 {width:380px;}
.w430{ width:470px;}
.w455{width:455px !important;}
.w465{width:465px !important;}