From 56150e44cee595b3daf13192f9e66116e4f0367f Mon Sep 17 00:00:00 2001 From: sw <939547590@qq.com> Date: Sat, 22 Nov 2014 09:49:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=82=AE=E4=BB=B6=E8=AF=BE?= =?UTF-8?q?=E7=A8=8B=E4=BD=9C=E4=B8=9A=E5=9C=A8=E6=96=B0=E7=AA=97=E5=8F=A3?= =?UTF-8?q?=E6=89=93=E5=BC=80=E7=BD=91=E9=A1=B5=E6=8A=A5500=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/homework_attach_controller.rb | 22 +-- app/views/homework_attach/show.html.erb | 177 +----------------- 2 files changed, 3 insertions(+), 196 deletions(-) diff --git a/app/controllers/homework_attach_controller.rb b/app/controllers/homework_attach_controller.rb index 61760f462..0286fcad6 100644 --- a/app/controllers/homework_attach_controller.rb +++ b/app/controllers/homework_attach_controller.rb @@ -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") diff --git a/app/views/homework_attach/show.html.erb b/app/views/homework_attach/show.html.erb index 5f631c26a..d2f096bae 100644 --- a/app/views/homework_attach/show.html.erb +++ b/app/views/homework_attach/show.html.erb @@ -1,175 +1,2 @@ -<%= render :partial => 'layouts/base_homework_attach', :locals => {:homework_attach => @homework} %> - -<% is_student = is_cur_course_student @homework.bid.courses.first %> -<% is_teacher = is_course_teacher User.current,@homework.bid.courses.first %> -

<%= notice %>

-
- - - - - - - - - - - - - - - - - - - - -
作业基础信息<%=@count %>
- 发布人员:<%= link_to @homework.user, user_path(@homework.user)%> - - 所属任务:<%= link_to(@homework.bid.name, course_for_bid_path(@homework.bid))%> -
- 作业下载: - <% if @is_evaluation || is_teacher%> - <% options = {:author => true } %> - <%= render :partial => 'app_link', :locals => {:attachments => @homework.attachments, :options => options} %> - <% else %> - <%= l(:label_cant_download) %> - <% end %> - - 参与人员: - <% @homework.users.each do |homework_user| %> - <%= link_to homework_user, user_path(homework_user)%> - <% if @homework.users.count > 1 && homework_user != @homework.users.last %> -
                 - <% end %> - <% end %> -
平均评分: - <%= render :partial => 'show_score', :locals => {:stars => @totle_score} %> - 发布时间:<%=format_time @homework.created_at %>
- - -
-
- -
- - - - - - - - - - - -
作业描述:
-
- <% if @homework.description != nil && @homework.description != "" %> - <%= @homework.description %> - <% else %> -
- 该作业无任何描述! -
- <% end %> -
-
- - -
-
- -
-
- 作业得分: -
-
-
-
得分比例
-
- <% 100.step(20,-20) do |star| %> -
-
-
-
-
-
- <%= @stars_status_map["star#{(star/20).to_s}".to_sym] %> -
- <% end %> -
-
-
-
最终得分
-
- <%= @totle_score %>分 -
-
- <%= render :partial => 'show_score', :locals => {:stars => @totle_score} %> -
-
-
-
打分总人数
-
- - <%= @homework.raters(:quality).count%> - -
-
-
-
-
- - -
- <%= render :partial => 'comprehensive_evaluation', :locals => {:comprehensive_evaluation => @comprehensive_evaluation,:homework => @homework, :teaher_score => @teaher_score} %> -
- -
- - -<% if !users_for_homework(@homework).include?(User.current) %> -
-
作业评论:
- <% if is_student %> - <% if @is_evaluation %> - <% if @has_evaluation %> -
- <%= l(:lable_has_evaluation)%> -
- <% else %> - <%= render :partial => 'evaluation', :locals => {:homework => @homework} %> - <% end %> - <% else %> -
- <%= l(:lable_close_evaluation)%> -
- <% end %> - <% end %> -
-<% end %> - -<% if !is_teacher %> - -
- <%= render :partial => 'addjour', :locals => {:homework_attach => @homework, :sta => 0, :is_comprehensive_evaluation => nil} %> -
-<% end %> - - - -
- <%= render :partial => 'showjour', :locals => {:jour => @jour,:homework => @homework} %> -
- -
-
+<%= stylesheet_link_tag 'css', :media => 'all' %> +<%= render :partial => "show"%> \ No newline at end of file