竞赛提交的评分

This commit is contained in:
cxt 2017-01-06 15:00:14 +08:00
parent 1fce3e7778
commit 9130111b2c
22 changed files with 349 additions and 108 deletions

View File

@ -48,10 +48,13 @@ class ContestantWorksController < ApplicationController
@all_homework_commons = @contest.works.order("created_at desc") @all_homework_commons = @contest.works.order("created_at desc")
@is_teacher = User.current.admin_of_contest?(@contest) || User.current.admin? @is_teacher = User.current.admin_of_contest?(@contest) || User.current.admin?
@is_judge = User.current.judge_of_contest?(@contest) @is_judge = User.current.judge_of_contest?(@contest)
@is_evaluation = @is_judge && @contestwork.work_status == 3 && @contestwork.online_evaluation
@show_all = false @show_all = false
if @is_teacher || @is_judge is_judge_open = @is_judge && (!@contestwork.online_evaluation || (@contestwork.online_evaluation && @contestwork.work_status == 4))
is_contestant_open = User.current.contestant_of_contest?(@contest) && ((!@contestwork.online_evaluation && @contestwork.work_status == 2 && @contestwork.score_open) || (@contestwork.online_evaluation && @contestwork.work_status == 4 && @contestwork.score_open))
if @is_teacher || is_judge_open || is_contestant_open
# if @order == 'lastname' # if @order == 'lastname'
# @stundet_works = search_homework_member @homework.student_works.no_copy.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.no_copy.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' # elsif @order == 'student_id'
@ -60,7 +63,15 @@ class ContestantWorksController < ApplicationController
@stundet_works = @contestwork.contestant_works.no_copy.select("contestant_works.*,contestant_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :contestant_work_scores => {}).order("#{@order} #{@b_sort}") @stundet_works = @contestwork.contestant_works.no_copy.select("contestant_works.*,contestant_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :contestant_work_scores => {}).order("#{@order} #{@b_sort}")
#end #end
@show_all = true @show_all = true
elsif User.current.member_of_contest?(@contest) elsif @is_evaluation
if @contestwork.work_detail_manual.evaluation_num == -1
@stundet_works = @contestwork.contestant_works.no_copy.select("contestant_works.*,contestant_works.work_score as score").includes(:user => {:user_extensions => []}, :project => {}, :contestant_work_scores => {}).order("#{@order} #{@b_sort}")
else
@stundet_works = User.current.contestant_work_evaluation_distributions.map(&:contestant_work).select { |cwork| cwork.work_id == @contestwork.id}
end
elsif User.current.judge_of_contest?(@contest)
@stundet_works = []
elsif User.current.contestant_of_contest?(@contest)
if @contestwork.work_type == 3 if @contestwork.work_type == 3
pro = @contestwork.contestant_work_projects.where(:user_id => User.current.id).first pro = @contestwork.contestant_work_projects.where(:user_id => User.current.id).first
if pro.nil? if pro.nil?
@ -95,9 +106,10 @@ class ContestantWorksController < ApplicationController
end end
def show def show
#@score = student_work_score @work,User.current @score = ContestantWorkScore.where(:user_id => User.current.id,:contestant_work_id => @work.id,:reviewer_role => 2).last
@is_evaluation = User.current.judge_of_contest?(@contest) && @contestwork.work_status == 3 && @contestwork.online_evaluation
@is_teacher = User.current.admin_of_contest?(@contest) || User.current.judge_of_contest?(@contest) || User.current.admin? @is_teacher = User.current.admin_of_contest?(@contest) || User.current.judge_of_contest?(@contest) || User.current.admin?
if @contestwork.work_status == 3 && User.current.judge_of_contest?(@contest) && @contestwork.online_evaluation if @is_evaluation
@student_work_scores = @work.contestant_work_scores.where("user_id = #{User.current.id} and reviewer_role = 2").order("updated_at desc") @student_work_scores = @work.contestant_work_scores.where("user_id = #{User.current.id} and reviewer_role = 2").order("updated_at desc")
else else
@student_work_scores = contestant_work_score_record(@work) @student_work_scores = contestant_work_score_record(@work)
@ -368,9 +380,10 @@ class ContestantWorksController < ApplicationController
def add_score def add_score
@is_last = params[:is_last] == "true" @is_last = params[:is_last] == "true"
@is_teacher = User.current.admin_of_contest?(@contest) || User.current.judge_of_contest?(@contest) || User.current.admin? @is_evaluation = User.current.judge_of_contest?(@contest) && @contestwork.work_status == 3 && @contestwork.online_evaluation
#@is_teacher = User.current.admin_of_contest?(@contest) || User.current.judge_of_contest?(@contest) || User.current.admin?
#老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分 #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分
render_403 and return unless User.current.judge_of_contest?(@contest) && @contestwork.work_status == 3 render_403 and return unless @is_evaluation
@is_last_a = @work.contestant_work_scores.empty? @is_last_a = @work.contestant_work_scores.empty?
@new_score = ContestantWorkScore.new @new_score = ContestantWorkScore.new
@new_score.score = params[:score].to_i @new_score.score = params[:score].to_i
@ -403,6 +416,8 @@ class ContestantWorksController < ApplicationController
@contestwork.update_column('updated_at', Time.now) @contestwork.update_column('updated_at', Time.now)
update_contest_activity(@contestwork.class,@contestwork.id) update_contest_activity(@contestwork.class,@contestwork.id)
update_user_activity(@contestwork.class,@contestwork.id) update_user_activity(@contestwork.class,@contestwork.id)
judge_score = ContestantWorkScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{@work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.judge_score = judge_score.first.score.nil? ? nil : judge_score.first.score.try(:round, 2).to_f
if @work.save if @work.save
@work = @contestwork.contestant_works.select("contestant_works.*,contestant_works.work_score as score").where(:id => @work.id).first @work = @contestwork.contestant_works.select("contestant_works.*,contestant_works.work_score as score").where(:id => @work.id).first
@count = @contestwork.contestant_works.has_committed.count @count = @contestwork.contestant_works.has_committed.count

View File

@ -257,11 +257,11 @@ class WorksController < ApplicationController
score_valid = params[:score_valid].to_i == 1 ? true : false score_valid = params[:score_valid].to_i == 1 ? true : false
if score_valid != @contestwork.score_valid if score_valid != @contestwork.score_valid
@contestwork.score_valid = score_valid @contestwork.score_valid = score_valid
@contestwork.save
@contestwork.contestant_works.has_committed.each do |c_work| @contestwork.contestant_works.has_committed.each do |c_work|
c_work.save c_work.save
end end
end end
@contestwork.save
if params[:student_path] && params[:student_path] == "true" if params[:student_path] && params[:student_path] == "true"
redirect_to contestant_works_path(:work => @contestwork.id) redirect_to contestant_works_path(:work => @contestwork.id)
else else

View File

@ -3964,6 +3964,10 @@ def get_cw_status contest_work
end end
elsif contest_work.work_status == 2 elsif contest_work.work_status == 2
str += '<span class="red_homework_btn_cir ml5">提交已截止</span>' str += '<span class="red_homework_btn_cir ml5">提交已截止</span>'
elsif contest_work.work_status == 3
str += '<span class="green_homework_btn_cir ml5">在线评审中</span>'
elsif contest_work.work_status == 4
str += '<span class="red_homework_btn_cir ml5">评审已截止</span>'
end end
str str
end end

View File

@ -18,15 +18,14 @@ module ContestantWorksHelper
def set_final_score contestwork, contestant_work def set_final_score contestwork, contestant_work
if contestwork.online_evaluation if contestwork.online_evaluation
if contestwork.score_valid if contestwork.score_valid
if ContestantWorkScore.find_by_sql("SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id").count < 2 contestant_work.work_score = contestant_work.judge_score
judge_score = ContestantWorkScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") else
if ContestantWorkScore.find_by_sql("SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id").count <= 2
contestant_work.work_score = contestant_work.judge_score
else else
judge_score = ContestantWorkScore.find_by_sql("SELECT (SUM(score)-MIN(score)-MAX(score))/(COUNT(score)-2) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a") judge_score = ContestantWorkScore.find_by_sql("SELECT (SUM(score)-MIN(score)-MAX(score))/(COUNT(score)-2) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
contestant_work.work_score = judge_score.first.score.try(:round, 2).to_f
end end
@work.work_score = judge_score.first.score.try(:round, 2).to_f
else
judge_score = ContestantWorkScore.find_by_sql("SELECT AVG(score) AS score FROM (SELECT * FROM (SELECT * FROM contestant_work_scores WHERE contestant_work_id = #{contestant_work.id} AND reviewer_role = 2 ORDER BY created_at DESC) AS t GROUP BY user_id) AS a")
@work.work_score = judge_score.first.score.try(:round, 2).to_f
end end
else else
contestant_work.work_score = nil contestant_work.work_score = nil

View File

@ -2,6 +2,7 @@ class ContestantWorkScore < ActiveRecord::Base
belongs_to :contestant_work belongs_to :contestant_work
belongs_to :user belongs_to :user
attr_accessible :comment, :reviewer_role, :score, :contestant_work_id, :user_id attr_accessible :comment, :reviewer_role, :score, :contestant_work_id, :user_id
acts_as_attachable
has_many :journals_for_messages has_many :journals_for_messages
end end

View File

@ -114,6 +114,13 @@ class User < Principal
has_many :apply_homeworks, :dependent => :destroy has_many :apply_homeworks, :dependent => :destroy
has_many :apply_resources, :dependent => :destroy has_many :apply_resources, :dependent => :destroy
#end #end
#竞赛
has_many :contests, :dependent => :destroy
has_many :works, :dependent => :destroy
has_many :contestant_works, :dependent => :destroy
has_many :contestant_work_evaluation_distributions, :dependent => :destroy
has_many :contestant_work_scores
has_many :contestant_work_projects
has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)}, has_and_belongs_to_many :groups, :after_add => Proc.new {|user, group| group.user_added(user)},
:after_remove => Proc.new {|user, group| group.user_removed(user)} :after_remove => Proc.new {|user, group| group.user_removed(user)}

View File

@ -1,4 +1,4 @@
<%= form_for('new_form', :remote => true, :method => :post,:url => add_score_contestant_works_path(work.id),:id=>'add_score_'+work.id.to_s) do |f|%> <%= form_for('new_form', :remote => true, :method => :post,:url => add_score_contestant_work_path(work.id),:id=>'add_score_'+work.id.to_s) do |f|%>
<li > <li >
<span class="tit_fb"> 评价:</span> <span class="tit_fb"> 评价:</span>
<%= f.text_area 'user_message', :class => 'hwork_ping_text', :id => 'score_comment_'+work.id.to_s, :placeholder => l(:text_caracters_maximum,:count=>500),:maxlength => 500 %> <%= f.text_area 'user_message', :class => 'hwork_ping_text', :id => 'score_comment_'+work.id.to_s, :placeholder => l(:text_caracters_maximum,:count=>500),:maxlength => 500 %>
@ -40,11 +40,4 @@
$('#about_hwork_'+id).html(''); $('#about_hwork_'+id).html('');
} }
} }
function submit_teacher_score(id){
if (first_click_score) {
first_click_score = false;
$("#work_submit_"+id).parent().parent().submit();
hideModal();
}
}
</script> </script>

View File

@ -0,0 +1,9 @@
<div class="syllabus_courses_box">
<% @stundet_works.each_with_index do |student_work, i| %>
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default; background-color:#f6f6f6;">
<%= render :partial => 'contest_evaluation_group_work', :locals => {:student_work => student_work} %>
</div>
<div id="about_hwork_<%= student_work.id %>" class="about_hwork"></div>
<% end %>
</div>
<div class="cl"></div>

View File

@ -0,0 +1,68 @@
<div class="sy_courses_open f14 fontGrey3">
<div>
<span class="fl" style="width:280px;" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl">
<% if student_work.work_status %>
<%= get_status student_work.work_status %>
<% end %>
</span>
</span>
<a href="javascript:void(0)" class="linkBlue2 fr" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">评分</a>
<div class="cl"></div>
<% if @contestwork.work_detail_group.base_on_project %>
<div class="pr">
<span class="fl fontGrey2">关联项目:</span>
<div class="fl projectName">
<% if student_work.project.status != 9 && (student_work.project.is_public || User.current.member_of?(student_work.project) || User.current.admin? || User.current.admin_of_contest?(@contestwork.contest) || User.current.judge_of_contest?(@contestwork.contest)) %>
<%= link_to student_work.project.name, project_path(student_work.project.id), :class => 'link-blue fl hidden', :style => "max-width:550px;", :title => "项目名称", :target => "_blank" %>
<% elsif student_work.project.status != 9 %>
<span class="fontBlue fr hidden" style="max-width:550px;" title="该项目是私有的"><%= student_work.project.name %></span>
<% else %>
<span class="fontGrey2 fr hidden" style="max-width:550px;" title="该项目已删除"><%= student_work.project.name %>(已删除)</span><% end %>
<% project = student_work.project %>
<div class="score-tip none tl f12" style="width:300px; top:-48px; right:-372px;">
<em style="bottom:45px;"></em>
<font style="bottom:45px;"></font>
<p class="fb break_word mw280"><%= project.name %><%= project.status == 9 ? "(已删除)" : ""%></p>
<p class="mb10">
<span class="mr15">创建者:<%= project.creater %></span><span>成员数量:<%= project.members.count %></span></p>
<% project_score = project.project_score %>
<p>项目综合得分:<%= project.status == 9 ? 0 : static_project_score(project_score).to_i %></p>
<% if project.status != 9 %>
<p>= 代码提交得分 + issue得分 + 资源得分 + 帖子得分</p>
<p>= <%= (project_score.changeset_num||0) * 4 %>
+ <%= project_score.issue_num * 4 + project_score.issue_journal_num %> + <%= project_score.attach_num * 5 %>
+ <%= project_score.board_num * 2 + project_score.board_message_num + project_score.news_num %></p>
<% end %>
</div>
</div>
</div>
<% end %>
</div>
<div class="cl"></div>
</div>
<div class="fl sy_p_grey" style="margin-left: 0px;" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
<span class="fl" style="width:180px;">提交时间:<%= format_date(student_work.commit_time) %></span>
<span class="fl" style="width:105px; text-align: center">人数:<%=student_work.contestant_work_projects.count %>人</span>
<div class="flex-container fl" style="width:400px;">
<div class="flex-cell">我的评分:
<% my_score = ContestantWorkScore.where(:user_id => User.current.id,:contestant_work_id => student_work.id,:reviewer_role => 2).last %>
<span class="<%= my_score.nil? ? 'c_grey' : score_color(my_score.score) %>"><%= my_score.nil? ? "--" : format("%.1f",my_score.score)%></span>
</div>
</div>
</div>
<div class="cl"></div>
<script>
$(".projectName").mouseenter(function () {
$(this).children().next().show();
}).mouseleave(function () {
$(this).children().next().hide();
});
</script>

View File

@ -0,0 +1,29 @@
<table class="hwork-table-wrap" id="homework_table">
<tr class="b_grey hworkH30">
<th class="hworkList40 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th>
<th class="hworkList230 pl5 pr5 hide-text">
姓名
</th>
<th class="hworkList190">
提交时间
</th>
<th class="hworkList140">
我的评分
</th>
<th class="hworkList40 pl5 pr5 hide-text">
</th>
</tr>
<%# end %>
<% @stundet_works.each_with_index do |student_work, i| %>
<% score_open = true %>
<a name="<%= student_work.id%>"></a>
<%= render :partial => "contest_evaluation_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open} %>
<tr>
<td colspan="12">
<div id="about_hwork_<%= student_work.id %>" class="about_hwork">
</div>
</td>
</tr>
<% end %>
</table>

View File

@ -1,9 +1,16 @@
<div class="syllabus_courses_box"> <% if @is_judge && @contestwork.online_evaluation && @contestwork.work_status < 3 %>
<% @stundet_works.each_with_index do |student_work, i| %> <div class="pro_new_info mt50" style="width:720px;height:405px;">
<div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');" style="cursor: default; background-color:#f6f6f6;"> <div class="icons_tishi"><img src="/images/new_project/icons_smile.png" width="110" height="110" alt=""></div>
<%= render :partial => 'contest_evaluation_un_group_work', :locals => {:student_work => student_work} %> <p class="sy_tab_con_p ">在线评审启动之前,无法查看具体作品</p>
</div> </div>
<div id="about_hwork_<%= student_work.id %>" class="about_hwork"></div> <% else %>
<% end %> <div class="syllabus_courses_box">
</div> <% @stundet_works.each_with_index do |student_work, i| %>
<div class="cl"></div> <div class="syllabus_courses_list" id="student_work_<%= student_work.id%>" style="cursor: default; background-color:#f6f6f6;">
<%= render :partial => 'contest_evaluation_un_group_work', :locals => {:student_work => student_work} %>
</div>
<div id="about_hwork_<%= student_work.id %>" class="about_hwork"></div>
<% end %>
</div>
<div class="cl"></div>
<% end %>

View File

@ -1,13 +1,14 @@
<div class="sy_courses_open f14 fontGrey3"> <div class="sy_courses_open f14 fontGrey3">
<div> <div>
<span class="fl" style="width:280px;"> <span class="fl" style="width:280px;" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
<span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span> <span class="hidden fl" style="max-width:220px;"><%= student_work.name %></span>
<span class="fontGrey2 ml5 fl"> <span class="fontGrey2 ml5 fl">
<% if student_work.work_status %> <% if student_work.work_status %>
<%= get_status student_work.work_status %> <%= get_status student_work.work_status %>
<% end %> <% end %>
</span>
</span> </span>
</span> <a href="javascript:void(0)" class="linkBlue2 fr" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">查看</a>
<div class="cl"></div> <div class="cl"></div>
<% if @contestwork.work_detail_group.base_on_project %> <% if @contestwork.work_detail_group.base_on_project %>
<div class="pr"> <div class="pr">
@ -45,13 +46,37 @@
</div> </div>
<div class="cl"></div> <div class="cl"></div>
</div> </div>
<div class="fl sy_p_grey" style="margin-left: 0px;"> <div class="fl sy_p_grey" style="margin-left: 0px;" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
<span class="fl" style="width:180px;">提交时间:<%= format_date(student_work.commit_time) %></span> <span class="fl" style="width:180px;">提交时间:<%= format_date(student_work.commit_time) %></span>
<span class="fl" style="width:105px; text-align: center">人数:<%=student_work.contestant_work_projects.count %>人</span> <span class="fl" style="width:105px; text-align: center">人数:<%=student_work.contestant_work_projects.count %>人</span>
<div class="flex-container fl" style="width:400px;"> <div class="flex-container fl" style="width:400px;">
<div class="flex-cell">评委评分:--</div> <div class="flex-cell">评委评分:
<div class="flex-cell">最终成绩:--</div> <span class="<%= score_color student_work.judge_score %>"><%=student_work.judge_score.nil? ? "--" : format("%.1f",student_work.judge_score) %></span>
<% unless student_work.judge_score.nil? %>
<span class="<%= score_color student_work.judge_score %>">(<%= student_work.contestant_work_scores.where(:reviewer_role => 2).group_by(&:user_id).count%>)</span>
<% end %>
</div>
<div class="flex-cell student_final_scor_info pr">最终成绩:
<span class="<%= score_color student_work.work_score %>"><%=student_work.work_score.nil? ? "--" : format("%.1f",student_work.work_score) %></span>
<% unless student_work.work_score.nil? %>
<div class="contest-group-score-tip none tl" style="line-height: 18px;">
<em></em>
<font></font>
评委平均分
<span class="c_red">&nbsp;<%= format("%.1f",student_work.judge_score < 0 ? 0 : student_work.judge_score)%>&nbsp;</span>分<br/>
<% if !@contestwork.score_valid && student_work.contestant_work_scores.where(:reviewer_role => 2).group_by(&:user_id).count > 2 %>
<% work_scores = student_work.contestant_work_scores.where(:reviewer_role => 2).order("score desc") %>
去除最高分
<span class="c_red">&nbsp;<%= format("%.1f",work_scores.first.score < 0 ? 0 : work_scores.first.score) %>&nbsp;</span>分<br/>
去除最低分
<span class="c_red">&nbsp;<%= format("%.1f",work_scores.last.score < 0 ? 0 : work_scores.last.score) %>&nbsp;</span>分<br/>
<% end %>
作品最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.work_score < 0 ? 0 : student_work.work_score)%>&nbsp;</span>分<br/>
</div>
<% end %>
</div>
</div> </div>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,34 +1,30 @@
<table class="hwork-table-wrap" id="homework_table"> <%# end %>
<%# if @homework.homework_type == 1 %> <% if @is_judge && @contestwork.online_evaluation && @contestwork.work_status < 3 %>
<%#= render :partial => 'evaluation_un_common_title' %> <div class="pro_new_info mt50" style="width:720px;height:405px;">
<%# elsif @homework.homework_type == 2 %> <div class="icons_tishi"><img src="/images/new_project/icons_smile.png" width="110" height="110" alt=""></div>
<%#= render :partial => 'evaluation_un_pro_title' %> <p class="sy_tab_con_p ">在线评审启动之前,无法查看具体作品</p>
<%# elsif @homework.homework_type == 3 %> </div>
<%#= render :partial => 'evaluation_un_group_title' %> <% else %>
<%# else %> <table class="hwork-table-wrap" id="homework_table">
<tr class="b_grey hworkH30"> <tr class="b_grey hworkH30">
<th class="hworkList40 hworkH30 pl5 pr5">序号</th> <th class="hworkList40 hworkH30 pl5 pr5">序号</th>
<th class="hworkList50">&nbsp;</th> <th class="hworkList50">&nbsp;</th>
<th class="hworkList190 pl5 pr5 hide-text"> <th class="hworkList230 pl5 pr5 hide-text">
姓名 姓名
</th> </th>
<th class="hworkList130">
<th class="hworkList80 pl5 pr5 hide-text"> 提交时间
</th> </th>
<th class="hworkList100">
<th class="hworkList130"> 评委评分
状态 </th>
</th> <th class="hworkList100">
<th class="hworkList100"> 最终成绩
评委评分 </th>
</th> <th class="hworkList40 pl5 pr5 hide-text">
</th>
<th class="hworkList100"> </tr>
最终成绩 <% @stundet_works.each_with_index do |student_work, i| %>
</th>
</tr>
<%# end %>
<% @stundet_works.each_with_index do |student_work, i| %>
<% score_open = true %> <% score_open = true %>
<a name="<%= student_work.id%>"></a> <a name="<%= student_work.id%>"></a>
<%= render :partial => "contest_evaluation_un_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open} %> <%= render :partial => "contest_evaluation_un_work", :locals => {:student_work => student_work, :index => i, :score_open => score_open} %>
@ -38,5 +34,6 @@
</div> </div>
</td> </td>
</tr> </tr>
<% end %> <% end %>
</table> </table>
<% end %>

View File

@ -3,24 +3,42 @@
<td class="hworkPortrait pr10 float-none"> <td class="hworkPortrait pr10 float-none">
<%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_path(student_work.user), :target => '_blank') %> <%= link_to(image_tag(url_to_avatar(student_work.user),:width =>"40",:height => "40",:style => "display:block;"),user_path(student_work.user), :target => '_blank') %>
</td> </td>
<td class="hworkStName190 pr10 float-none hidden" title="<%= student_work.user.show_name%>" style="cursor:pointer; text-align: center;"> <td class="hworkList230 pl5 pr5 float-none hidden" title="<%= student_work.user.show_name%>" style="cursor:pointer; text-align: center;">
<%= link_to student_work.user.show_name ,user_path(student_work.user), :target => '_blank' %> <%= link_to student_work.user.show_name ,user_path(student_work.user), :target => '_blank' %>
</td> </td>
<td class="hworkList80 student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">
</td>
<td class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');" style="cursor: pointer;"> <td class="hworkList130 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');" style="cursor: pointer;">
<% if student_work.work_status%> <%=format_time student_work.commit_time %>
<%=get_status student_work.work_status %> </td>
<td class="hworkList100 <%= score_color student_work.judge_score %>">
<%=student_work.judge_score.nil? ? "--" : format("%.1f",student_work.judge_score) %>
<% unless student_work.judge_score.nil? %>
<span>(<%= student_work.contestant_work_scores.where(:reviewer_role => 2).group_by(&:user_id).count%>)</span>
<% end %> <% end %>
</td> </td>
<td class="hworkList100 <%= score_color nil %>">
--
</td>
<td class="hworkList100 <%= score_color nil %> student_final_scor_info pr"> <td class="hworkList100 <%= score_color student_work.work_score %> student_final_scor_info pr">
-- <%=student_work.work_score.nil? ? "--" : format("%.1f",student_work.work_score) %>
<% unless student_work.work_score.nil? %>
<div class="contest-score-tip none tl" style="line-height: 18px;">
<em></em>
<font></font>
评委平均分
<span class="c_red">&nbsp;<%= format("%.1f",student_work.judge_score < 0 ? 0 : student_work.judge_score)%>&nbsp;</span>分<br/>
<% if !@contestwork.score_valid && student_work.contestant_work_scores.where(:reviewer_role => 2).group_by(&:user_id).count > 2 %>
<% work_scores = student_work.contestant_work_scores.where(:reviewer_role => 2).order("score desc") %>
去除最高分
<span class="c_red">&nbsp;<%= format("%.1f",work_scores.first.score < 0 ? 0 : work_scores.first.score) %>&nbsp;</span>分<br/>
去除最低分
<span class="c_red">&nbsp;<%= format("%.1f",work_scores.last.score < 0 ? 0 : work_scores.last.score) %>&nbsp;</span>分<br/>
<% end %>
作品最终成绩为
<span class="c_red">&nbsp;<%= format("%.1f",student_work.work_score < 0 ? 0 : student_work.work_score)%>&nbsp;</span>分<br/>
</div>
<% end %>
</td>
<td class="hworkList40 student_work_<%= student_work.id%>">
<a href="javascript:void(0)" class="linkBlue2" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">查看</a>
</td> </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> <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> </tr>

View File

@ -0,0 +1,33 @@
<tr class="hworkListRow" id="student_work_<%= student_work.id%>">
<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_path(student_work.user), :target => '_blank') %>
</td>
<td class="hworkList230 pl5 pr5 float-none hidden" title="<%= student_work.user.show_name%>" style="cursor:pointer; text-align: center;">
<%= link_to student_work.user.show_name ,user_path(student_work.user), :target => '_blank' %>
</td>
<td class="hworkList190 c_grey student_work_<%= student_work.id%>" onclick="show_student_work('<%= contestant_work_path(student_work)%>');" style="cursor: pointer;">
<%=format_time student_work.commit_time %>
</td>
<% my_score = ContestantWorkScore.where(:user_id => User.current.id,:contestant_work_id => student_work.id,:reviewer_role => 2).last %>
<td class="hworkList140 <%= my_score.nil? ? 'c_grey' : score_color(my_score.score) %> student_final_scor_info pr">
<%= my_score.nil? ? "--" : format("%.1f",my_score.score)%>
</td>
<td class="hworkList40 student_work_<%= student_work.id%>">
<a href="javascript:void(0)" class="linkBlue2" onclick="show_student_work('<%= contestant_work_path(student_work)%>');">评分</a>
</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() == "") {
$("#work_click_<%= student_work.id%>").show();
}
}).mouseleave(function(){
$("#work_click_<%= student_work.id%>").hide();
}).mouse;
</script>

View File

@ -38,9 +38,17 @@
<div class="fl"> <div class="fl">
<% if @contestwork.work_type != 3%> <% if @contestwork.work_type != 3%>
<%= render :partial => "contest_evaluation_un_title"%> <% if @is_evaluation && !@stundet_works.empty? %>
<%= render :partial => "contest_evaluation_title"%>
<% else%>
<%= render :partial => "contest_evaluation_un_title"%>
<% end%>
<% else %> <% else %>
<%= render :partial => "contest_evaluation_un_group"%> <% if @is_evaluation && !@stundet_works.empty? %>
<%= render :partial => "contest_evaluation_group"%>
<% else %>
<%= render :partial => "contest_evaluation_un_group"%>
<% end%>
<% end %> <% end %>
</div> </div>
<div class="cl"></div> <div class="cl"></div>

View File

@ -1,16 +1,14 @@
<ul class="ping_box_ul <%= is_last ? '' : 'ping_line'%> fl"> <ul class="ping_box_ul <%= is_last ? '' : 'ping_line'%> fl">
<% show_real_name = @is_teacher || score.user == User.current || score.reviewer_role != 3 %> <%= link_to image_tag(url_to_avatar(score.user), :width => "34", :height => "34"), user_path(score.user), :class => "ping_pic fl" %>
<%= link_to image_tag(url_to_avatar(show_real_name ? score.user : ""), :width => "34", :height => "34"), show_real_name ? user_path(score.user) : "javascript:void(0)",:class => "ping_pic fl" %>
<% show_real_score = @contestwork.score_open || @is_teacher || score.contestant_work.user == User.current || score.user == User.current %>
<div class="pingBoxTit"> <div class="pingBoxTit">
<%= link_to show_real_name ? score.user.show_name : "匿名", show_real_name ? user_path(score.user) : "javascript:void(0)", :title => show_real_name ? score.user.show_name : "匿评用户", :class => "linkBlue fl" %> <%= link_to score.user.show_name, user_path(score.user), :title => score.user.show_name, :class => "linkBlue fl" %>
<span class="ml5 fl"> <span class="ml5 fl">
<%= student_work_score_role score%> 评委
</span> </span>
<% unless score.score.nil? %> <% unless score.score.nil? %>
<span class="ml20 fl">评分:</span> <span class="ml20 fl">评分:</span>
<a href="javascript:void(0);" class="c_orange fl" > <a href="javascript:void(0);" class="c_orange fl" >
<%= show_real_score ? score.score : "**" %>分 <%= score.score %>分
</a> </a>
<% end %> <% end %>
<!--<a href="javascript:void(0);" class="fr linkBlue mr5" onclick="$('#add_score_reply_<%#= score.id%>').slideToggle();">回复</a>--> <!--<a href="javascript:void(0);" class="fr linkBlue mr5" onclick="$('#add_score_reply_<%#= score.id%>').slideToggle();">回复</a>-->

View File

@ -75,15 +75,15 @@
<% end%> <% end%>
<div class="cl"></div> <div class="cl"></div>
</li> </li>
<!--<li >--> <li >
<!--<%# if @contestwork.online_evaluation && User.current.judge_of_contest?(@contestwork.contest) && @contestwork.work_status == 3 %>--> <% if @is_evaluation %>
<!--&lt;!&ndash; 老师 || 开启匿评状态 && 不是当前用户自己的作品 &ndash;&gt;--> <!-- 评委&&评审中 -->
<!--<div id="add_student_score_<%#= work.id%>" class="mt10 evaluation">--> <div id="add_student_score_<%= work.id%>" class="mt10 evaluation">
<!--<%#= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>--> <%= render :partial => 'add_score',:locals => {:work => work,:score => score,:is_member_work => is_member_work}%>
<!--</div>--> </div>
<!--<%# end%>--> <% end%>
<!--<div class="cl"></div>--> <div class="cl"></div>
<!--</li>--> </li>
</ul> </ul>
<!--<div id="revise_attachment">--> <!--<div id="revise_attachment">-->
@ -104,9 +104,9 @@
<!--</ul>--> <!--</ul>-->
<% end %> <% end %>
<!--<div class="ping_box fl" id="score_list_<%#= work.id%>" style="<%#= student_work_scores.empty? ? 'padding:0px;' : ''%>">--> <div class="ping_box fl" id="score_list_<%= work.id%>" style="<%= student_work_scores.empty? ? 'padding:0px;' : ''%>">
<!--<%#= render :partial => 'contestant_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>--> <%= render :partial => 'contestant_work_score_records', :locals => {:student_work_scores => student_work_scores, :is_member_work => is_member_work} %>
<!--</div>--> </div>
<div class="cl"></div> <div class="cl"></div>
<!---ping_box end---> <!---ping_box end--->
<a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a> <a href="javascript:void(0);" class="linkBlue mt5 mb5" style="margin-left:auto; margin-right: auto; display:block; width: 24px;" onclick="$('#about_hwork_<%= work.id%>').html('');">收起</a>

View File

@ -9,9 +9,9 @@ var num = $("#work_num_<%= @work.id%>").html();
$("#score_list_<%= @work.id%>").removeAttr("style"); $("#score_list_<%= @work.id%>").removeAttr("style");
<% if @contestwork.work_type == 3 %> <% if @contestwork.work_type == 3 %>
$("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'contest_evaluation_un_group_work', :locals => {:student_work => @work}) %>"); $("#student_work_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'contest_evaluation_group_work', :locals => {:student_work => @work}) %>");
<% else %> <% else %>
$("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'contest_evaluation_un_work',:locals => {:student_work => @work, :index => 1, :score_open => score_open}) %>"); $("tr[id='student_work_<%= @work.id%>']").replaceWith("<%= escape_javascript(render :partial => 'contest_evaluation_work',:locals => {:student_work => @work, :index => 1, :score_open => score_open}) %>");
$("#work_num_<%= @work.id%>").html(num); $("#work_num_<%= @work.id%>").html(num);
<% end %> <% end %>

View File

@ -4,6 +4,6 @@ if($("#about_hwork_<%= @work.id%>").children().length > 0){
else{ else{
$(".about_hwork").html(""); $(".about_hwork").html("");
$("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work}) %>"); $("#about_hwork_<%= @work.id%>").html("<%= escape_javascript(render :partial => 'show',:locals => {:work =>@work, :score => @score, :student_work_scores => @student_work_scores}) %>");
$('#score_<%= @work.id%>').peSlider({range: 'min'}); $('#score_<%= @work.id%>').peSlider({range: 'min'});
} }

View File

@ -0,0 +1,5 @@
class AddJudgeScoreToContestantWork < ActiveRecord::Migration
def change
add_column :contestant_works, :judge_score, :integer
end
end

View File

@ -29,7 +29,25 @@ p.pro_new_grey{ line-height: 1.9; }
.undis {display:none;} .undis {display:none;}
.game-dis {display:block;} .game-dis {display:block;}
/* 竞赛*/ /* 竞赛*/
.banner-game { width: 968px; height: 110px;} .banner-game { width: 968px; height: 110px; position: relative; overflow: hidden;}
.banner-inner {
display: block;
position: absolute;
left: 0;
top: 100%;
width: 100%;
height: 100%;
background: #000;
text-align: center;
opacity: 0.3;
-moz-transition: top ease 200ms;
-o-transition: top ease 200ms;
-webkit-transition: top ease 200ms;
transition: top ease 200ms;
}
a.banner-notice {position: absolute; font-size: 16px; line-height: 20px; top: 152px; left: 394px; color: #fff; padding:2px 5px;}
.banner-game:hover .banner-inner { top: 0;}
.banner-game:hover .banner-notice { top: 42px;}
.sy_new_table tbody tr td.game-text-right{ text-align: right;} .sy_new_table tbody tr td.game-text-right{ text-align: right;}
.sy_new_table tbody tr td.game-text-left{ text-align: left;} .sy_new_table tbody tr td.game-text-left{ text-align: left;}
.game-setting-h3{ width: 100%; height: 40px; line-height: 40px; font-size: 14px; color: #666; font-weight: normal; background: #fff; border-bottom: 10px solid #eaebec;} .game-setting-h3{ width: 100%; height: 40px; line-height: 40px; font-size: 14px; color: #666; font-weight: normal; background: #fff; border-bottom: 10px solid #eaebec;}
@ -40,3 +58,10 @@ p.pro_new_grey{ line-height: 1.9; }
.contestRightBanner {width:718px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px;} .contestRightBanner {width:718px; margin:0px auto; float:right; background-color: #ffffff; padding:10px 15px;}
.sy_new_table tbody tr th{ height:40px; line-height:40px; border-bottom:1px solid #e5e5e5; color:#888;} .sy_new_table tbody tr th{ height:40px; line-height:40px; border-bottom:1px solid #e5e5e5; color:#888;}
.contest-score-tip {width:140px; color:#666; position:absolute; padding:3px 5px; border:1px solid #eaeaea; right:-223px; top:18px; background-color:#ffffff; line-height:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); white-space:nowrap;}
.contest-score-tip em {display:block; border-width:8px; position:absolute; top:6px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
.contest-score-tip font {display:block; border-width:8px; position:absolute; top:6px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;}
.contest-group-score-tip {width:140px; color:#666; position:absolute; padding:3px 5px; border:1px solid #eaeaea; right:-193px; top:-4px; background-color:#ffffff; line-height:20px; box-shadow:0px 2px 8px rgba(146, 153, 169, 0.5); white-space:nowrap;}
.contest-group-score-tip em {display:block; border-width:8px; position:absolute; top:6px; left:-16px; border-style:dashed solid dashed dashed; border-color:transparent #eaeaea transparent transparent; font-size:0; line-height:0;}
.contest-group-score-tip font {display:block; border-width:8px; position:absolute; top:6px; left:-15px; border-style:dashed solid dashed dashed; border-color:transparent #FFF transparent transparent; font-size:0; line-height:0;}