修改匿评

This commit is contained in:
z9hang 2014-11-08 14:03:02 +08:00
parent f0377ffae7
commit e297bb2687
4 changed files with 88 additions and 92 deletions

View File

@ -382,19 +382,19 @@ class HomeworkAttachController < ApplicationController
if User.current.admin? || User.current.member_of_course?(@homework.bid.courses.first)
# 打分统计
stars_reates = @homework. rates(:quality)
stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
stars_status = stars_reates.select("stars, count(*) as scount").group("stars")
@stars_status_map = Hash.new(0.0)
stars_status.each do |star_status|
percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f
percent_m = format("%.2f", percent)
@stars_status_map["star#{star_status.stars.to_i}".to_sym] =
percent_m.to_s + "%"
end
#stars_reates_count = stars_reates.count == 0 ? 1 : stars_reates.count
#stars_status = stars_reates.select("stars, count(*) as scount").group("stars")
#@stars_status_map = Hash.new(0.0)
#stars_status.each do |star_status|
# percent = (star_status.scount * 1.0/ stars_reates_count) * 100.to_f
# percent_m = format("%.2f", percent)
# @stars_status_map["star#{star_status.stars.to_i}".to_sym] =
# percent_m.to_s + "%"
#end
#是否已经进行过评价
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
#是否开启互评功能
@is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil
#@is_evaluation = @homework.bid.is_evaluation == 1 || @homework.bid.is_evaluation == nil
#@limit = 10
#@jours留言 is null条件用以兼容历史数据
@jours = @homework.journals_for_messages.where("is_comprehensive_evaluation = 3 or is_comprehensive_evaluation is null").order("created_on DESC")

View File

@ -1,81 +1,77 @@
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<script type="text/javascript" language="javascript">
//<!CDATA[
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>
</script>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<div id="popbox">
<div class="ping_con">
<h2><%= @homework.name %></h2>
<ul>
<li><%= l(:label_create_person) %>
<span class="c_grey">
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<% else %>
<%= link_to @homework.user, user_path(@homework.user)%>
<% end %>
</span>
</li>
<li style=" margin-left:130px;"><%= l(:label_activity_time) %><span class="c_grey" ><%=format_time @homework.created_at %></span></li>
</ul>
<div class="cl"></div>
<% if @homework.users.count > 0 %>
<div><%= l(:label_participation_person) %>
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<%else%>
<% @homework.users.each do |homework_user| %>
<span class="c_grey"><%= link_to homework_user, user_path(homework_user)%></span>
<% if @homework.users.count > 1 && homework_user != @homework.users.last %>
、&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<% end %>
<% end %>
</div>
<% end %>
<p>
<% if @homework.description != nil && @homework.description != "" %>
<%= @homework.description %>
<% else %>
<div style="font-size: 15px;color: #15BCCC;vertical-align:middle;padding-top: 10px;padding-left: 10px ">
<strong><%= l(:label_homework_without_description) %></strong>
</div>
<% end %>
</p>
<p style=" border-bottom:none; color:#333; margin-top:8px;"><strong><%= l(:label_attachment) %>
</strong>
<span>
<% if @is_evaluation || is_teacher%>
<% options = {:author => true } %>
<%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %>
<% else %>
<%= l(:label_cant_download) %>
<% end %>
</span>
</p>
<div class="ping_star" id="star_score">
<%= render :partial => 'show_star',:locals => {:is_comprehensive_evaluation => @is_comprehensive_evaluation,:totle_score => @totle_score,:has_evaluation => @has_evaluation ,
:homework => @homework} %>
</div>
<div class="cl"></div>
<div id="add_jour">
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
</div>
<div class="cl"></div>
</div><!---ping_con end--->
<%= render :partial => 'histoey_new' %>
</div>
<% reply_allow = JournalsForMessage.create_by_user? User.current %>
<script type="text/javascript" language="javascript">
//<!CDATA[
function g(o){return document.getElementById(o);}
function HoverLi(n){
//如果有N个标签,就将i<=N;
for(var i=3;i<=5;i++){g('ping_tb_'+i).className='ping_normaltab';g('tbc_0'+i).className='ping_undis';}g('tbc_0'+n).className='ping_dis';g('ping_tb_'+n).className='ping_hovertab';
}
//如果要做成点击后再转到请将<li>中的onmouseover 改成 onclick;
//]]>
</script>
<%= javascript_include_tag 'seems_rateable/jRating', 'seems_rateable/rateable'%>
<div id="popbox">
<div class="ping_con">
<h2><%= @homework.name %></h2>
<ul>
<li><%= l(:label_create_person) %>
<span class="c_grey">
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<% else %>
<%= link_to @homework.user, user_path(@homework.user)%>
<% end %>
</span>
</li>
<li style=" margin-left:130px;"><%= l(:label_activity_time) %><span class="c_grey" ><%=format_time @homework.created_at %></span></li>
</ul>
<div class="cl"></div>
<% if @homework.users.count > 0 %>
<div><%= l(:label_participation_person) %>
<% if @is_anonymous_comments && @is_comprehensive_evaluation != 1 %>
<%= l(:label_anonymous) %>
<%else%>
<% @homework.users.each do |homework_user| %>
<span class="c_grey"><%= link_to homework_user, user_path(homework_user)%></span>
<% if @homework.users.count > 1 && homework_user != @homework.users.last %>
、&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<% end %>
<% end %>
<% end %>
</div>
<% end %>
<p>
<% if @homework.description != nil && @homework.description != "" %>
<%= @homework.description %>
<% else %>
<div style="font-size: 15px;color: #15BCCC;vertical-align:middle;padding-top: 10px;padding-left: 10px ">
<strong><%= l(:label_homework_without_description) %></strong>
</div>
<% end %>
</p>
<p style=" border-bottom:none; color:#333; margin-top:8px;"><strong><%= l(:label_attachment) %>
</strong>
<span>
<% options = {:author => true } %>
<%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %>
</span>
</p>
<div class="ping_star" id="star_score">
<%= render :partial => 'show_star',:locals => {:is_comprehensive_evaluation => @is_comprehensive_evaluation,:totle_score => @totle_score,:has_evaluation => @has_evaluation ,
:homework => @homework} %>
</div>
<div class="cl"></div>
<div id="add_jour">
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => @is_comprehensive_evaluation} %>
</div>
<div class="cl"></div>
</div><!---ping_con end--->
<%= render :partial => 'histoey_new' %>
</div>
</div>

View File

@ -4,7 +4,7 @@
<% elsif is_comprehensive_evaluation == 2 %>
<% if has_evaluation %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %>
<%= rating_for homework, dimension: :quality, class: 'rateable div_inline' %>
<% else %>
<%= l(:label_work_rating) %>
<%= rating_for homework, dimension: :quality,start_score: 0, class: 'rateable div_inline' %>

View File

@ -138,7 +138,7 @@
$("p.jRatingInfos").remove();
},
click : function(e){
var flag = confirm("确定评分?(学生评分之后将无法修改)");
var flag = confirm("确定评分?");
if(!flag)
{
e.cancel();