修改匿评

Homework
z9hang 11 years ago
parent f0377ffae7
commit e297bb2687

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

@ -55,12 +55,8 @@
<p style=" border-bottom:none; color:#333; margin-top:8px;"><strong><%= l(:label_attachment) %> <p style=" border-bottom:none; color:#333; margin-top:8px;"><strong><%= l(:label_attachment) %>
</strong> </strong>
<span> <span>
<% if @is_evaluation || is_teacher%>
<% options = {:author => true } %> <% options = {:author => true } %>
<%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %> <%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %>
<% else %>
<%= l(:label_cant_download) %>
<% end %>
</span> </span>
</p> </p>

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

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

Loading…
Cancel
Save