修复邮件课程作业在新窗口打开网页报500的BUG
This commit is contained in:
parent
ea19c1aeef
commit
56150e44ce
|
@ -382,42 +382,22 @@ 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
|
||||
#是否已经进行过评价
|
||||
temp = HomeworkAttach.find_by_sql("SELECT stars FROM seems_rateable_rates WHERE rateable_type = 'HomeworkAttach' AND rateable_id = #{@homework.id} AND rater_id = #{User.current.id}").first
|
||||
@m_score = temp.nil? ? 0:temp.stars
|
||||
@has_evaluation = stars_reates.where("rater_id = ?",User.current).count > 0
|
||||
#是否开启互评功能
|
||||
#@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")
|
||||
@cur_page = params[:cur_page] || 1
|
||||
@cur_type = params[:cur_type] || 5
|
||||
@jour = paginateHelper @jours,5
|
||||
#@feedback_count = @jours.count
|
||||
#@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
||||
#@offset ||= @feedback_pages.offset
|
||||
#@jour = @jours[@offset, @limit]
|
||||
#@comprehensive_evaluation教师评论
|
||||
#@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1").order("created_on DESC")
|
||||
|
||||
teachers = searchTeacherAndAssistant @course
|
||||
@comprehensive_evaluation = []
|
||||
teachers.each do|teacher|
|
||||
temp = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id = #{teacher.user_id}").order("created_on DESC").first
|
||||
@comprehensive_evaluation << temp if temp
|
||||
end
|
||||
#@comprehensive_evaluation = @homework.journals_for_messages.where("is_comprehensive_evaluation = 1 and user_id in #{convert_array(teachers)}").order("created_on DESC")
|
||||
#@anonymous_comments 匿评
|
||||
#@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2").order("created_on DESC")
|
||||
annymous_users = @homework.homework_evaluations.map(&:user)
|
||||
unless annymous_users.nil? || annymous_users.count == 0
|
||||
@anonymous_comments = @homework.journals_for_messages.where("is_comprehensive_evaluation = 2 and user_id in #{convert_array(annymous_users)}").order("created_on DESC")
|
||||
|
|
|
@ -1,175 +1,2 @@
|
|||
<%= render :partial => 'layouts/base_homework_attach', :locals => {:homework_attach => @homework} %>
|
||||
<style>
|
||||
.softapplication-img .soft-application {
|
||||
float: left;
|
||||
width: 25%;
|
||||
height: 200px;
|
||||
}
|
||||
</style>
|
||||
<% is_student = is_cur_course_student @homework.bid.courses.first %>
|
||||
<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %>
|
||||
<p id="notice"><%= notice %></p>
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="320" >
|
||||
</td>
|
||||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr style="font-size: 18px">
|
||||
<td colspan="2" valign="top"><strong>作业基础信息<%=@count %></strong></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">
|
||||
发布人员:<%= link_to @homework.user, user_path(@homework.user)%>
|
||||
</td>
|
||||
<td style="width: 240px; word-wrap: break-word; word-break: break-all">
|
||||
所属任务:<%= link_to(@homework.bid.name, course_for_bid_path(@homework.bid))%>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding-left: 40px">
|
||||
<span>作业下载:</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 %>
|
||||
</td>
|
||||
<td style="width: 240px; word-wrap: break-word; word-break: break-all">
|
||||
参与人员:
|
||||
<% @homework.users.each do |homework_user| %>
|
||||
<%= link_to homework_user, user_path(homework_user)%>
|
||||
<% if @homework.users.count > 1 && homework_user != @homework.users.last %>
|
||||
<br/>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style=" padding-left: 40px">平均评分:
|
||||
<%= render :partial => 'show_score', :locals => {:stars => @totle_score} %>
|
||||
</td>
|
||||
<td style="width: 240px; word-wrap: break-word; word-break: break-all">发布时间:<%=format_time @homework.created_at %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<tr>
|
||||
<td colspan="2" valign="top" width="320" >
|
||||
</td>
|
||||
<td>
|
||||
<table width="100%" border="0">
|
||||
<tr>
|
||||
<td colspan="2" valign="top"><div style="font-size: 15px;"><strong>作业描述:</strong></div></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="width: 570px; padding-left:40px; word-wrap: break-word; word-break: break-all">
|
||||
<div style="padding-top: 5px">
|
||||
<% 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>该作业无任何描述!</strong>
|
||||
</div>
|
||||
<% end %>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<div style="height: auto; padding-bottom: 10px">
|
||||
<div style="font-size: 15px;">
|
||||
<strong>作业得分:</strong>
|
||||
</div>
|
||||
<div style="overflow: hidden">
|
||||
<div style="margin-left: 15%; float: left">
|
||||
<div style="padding-left: 45px; padding-bottom: 5px">得分比例</div>
|
||||
<div>
|
||||
<% 100.step(20,-20) do |star| %>
|
||||
<div data-kls="HomeworkAttach" data-id="2" data-dimension="quality" data-average="3.25" class="rateable div_inline jDisabled"
|
||||
style="height: 20px; width: 115px; overflow: hidden; z-index: 1; position: relative;">
|
||||
<div class="jRatingColor" style="width: <%=star%>%;"></div>
|
||||
<div class="jRatingAverage" style="width: 0px; top: -20px;"></div>
|
||||
<div class="jStar" style="width: 115px; height: 20px; top: -40px;
|
||||
background: url('/images/seems_rateable/stars.png') repeat-x scroll 0% 0% transparent;">
|
||||
</div>
|
||||
</div>
|
||||
<%= @stars_status_map["star#{(star/20).to_s}".to_sym] %>
|
||||
<br/>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="float: left; padding-left: 100px; padding-top:35px ">
|
||||
<div style="text-align: center">最终得分</div>
|
||||
<div style="padding-top: 1px; font-size: 15px; color: blue;text-align: center">
|
||||
<%= @totle_score %>分
|
||||
</div>
|
||||
<div style="padding-top: 3px">
|
||||
<%= render :partial => 'show_score', :locals => {:stars => @totle_score} %>
|
||||
</div>
|
||||
</div>
|
||||
<div style="float: left; padding-left: 100px; padding-top:35px ">
|
||||
<div>打分总人数</div>
|
||||
<div style="padding-left: 28px; padding-top: 1px; font-size: 25px; color: blue">
|
||||
<strong>
|
||||
<%= @homework.raters(:quality).count%>
|
||||
</strong>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<!-- 作业综评 -->
|
||||
<div id="comprehensive_evaluation">
|
||||
<%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score} %>
|
||||
</div>
|
||||
|
||||
<div class="underline-contests_one"></div>
|
||||
|
||||
<!-- 作业成员(发布人员和参与人员)不能对作业进行评分 -->
|
||||
<% if !users_for_homework(@homework).include?(User.current) %>
|
||||
<div style="height: 50px">
|
||||
<div style="font-size: 15px"><strong>作业评论:</strong></div>
|
||||
<% if is_student %>
|
||||
<% if @is_evaluation %>
|
||||
<% if @has_evaluation %>
|
||||
<div style="text-align: center;">
|
||||
<%= l(:lable_has_evaluation)%>
|
||||
</div>
|
||||
<% else %>
|
||||
<%= render :partial => 'evaluation', :locals => {:homework => @homework} %>
|
||||
<% end %>
|
||||
<% else %>
|
||||
<div style="text-align: center;">
|
||||
<%= l(:lable_close_evaluation)%>
|
||||
</div>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if !is_teacher %>
|
||||
<!--提示登录后对应用进行评价-->
|
||||
<div id="leave-message">
|
||||
<%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => nil} %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
<!-- 留言列表区 -->
|
||||
<div id="message" style="font-size: 14px;">
|
||||
<%= render :partial => 'showjour', :locals => {:jour => @jour,:homework => @homework} %>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
</div>
|
||||
<%= stylesheet_link_tag 'css', :media => 'all' %>
|
||||
<%= render :partial => "show"%>
|
Loading…
Reference in New Issue