diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index 474fb81bc..d570a31fc 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -72,80 +72,12 @@ class StudentWorkController < ApplicationController query.update_attributes(:viewed => true) end end - @order,@b_sort,@name,@group = params[:order] || "score",params[:sort] || "desc",params[:name] || "",params[:group] - @is_teacher = User.current.allowed_to?(:as_teacher,@course) - course_group = CourseGroup.find_by_id(@group) if @group - if course_group - group_students = course_group.users - if group_students.empty? - student_in_group = '(0)' - else - student_in_group = '(' + group_students.map{|user| user.id}.join(',') + ')' - end - #老师 || 非匿评作业 || 匿评结束 显示所有的作品 - @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? - if @show_all - if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name - end - else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - if my_work.empty? - @stundet_works = [] - else - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).where("users.id in #{student_in_group}").order("#{@order} #{@b_sort}"),@name - end - end - end - else #学生 - if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 - @is_evaluation = true - my_work = @homework.student_works.where(:user_id => User.current.id) - @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} - end - end - else - #老师 || 非匿评作业 || 匿评结束 显示所有的作品 - @show_all = @is_teacher || @homework.homework_type != 1 || @homework.homework_detail_manual.comment_status == 3 || User.current.admin? - if @show_all - if @homework.homework_type == 1 || @is_teacher || User.current.admin? #超级管理员 || 老师 || 匿评结束 显示所有的作品 - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name - end - else #剩余情况: 学生 && 非匿评作业 如果未提交作品,只能看到自己的,提交了作品,能看到所有作品 - my_work = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - if my_work.empty? - @stundet_works = [] - else - if @order == "name" - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").joins(:user).order("users.lastname #{@b_sort}, users.firstname #{@b_sort}"),@name - else - @stundet_works = search_homework_member @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").order("#{@order} #{@b_sort}"),@name - end - end - end - else #学生 - if @homework.homework_detail_manual.comment_status == 1 #未开启匿评,只显示我的作品 - @stundet_works = @homework.student_works.select("student_works.*,IF(final_score is null,null,final_score - absence_penalty - late_penalty) as score").where(:user_id => User.current.id) - elsif @homework.homework_detail_manual.comment_status == 2 #匿评列表,显示匿评作品和我的作品 - @is_evaluation = true - my_work = @homework.student_works.where(:user_id => User.current.id) - @stundet_works = my_work + User.current.student_works_evaluation_distributions.map(&:student_work).select { |work| work.homework_common_id == @homework.id} - end - end - end + + ################################################################################################################## + @stundet_works = @homework.student_works @homework_commons = @course.homework_commons.order("created_at desc") - @score = @b_sort == "desc" ? "asc" : "desc" + @is_teacher = User.current.allowed_to?(:as_teacher,@course) + respond_to do |format| format.html format.xls { @@ -264,7 +196,7 @@ class StudentWorkController < ApplicationController render_403 and return if User.current == @work.user #不可以匿评自己的作品 @is_teacher = User.current.allowed_to?(:as_teacher,@course) #老师、教辅可以随时评分,学生只能在匿评作业的匿评阶段进行评分 - render_403 and return unless @is_teacher || (@homework.homework_type == 1 && @homework.homework_detail_manual.comment_status == 2) + render_403 and return unless @is_teacher || @homework.homework_detail_manual.comment_status == 2 @score = student_work_score @work,User.current if @score @score.comment = params[:new_form][:user_message] if params[:new_form] && params[:new_form][:user_message] && params[:new_form][:user_message] != "" @@ -298,33 +230,10 @@ class StudentWorkController < ApplicationController case @score.reviewer_role when 1 #教师评分:最后一个教师评分为最终评分 @work.teacher_score = @score.score - @work.final_score = @score.score when 2 #教辅评分 教辅评分显示平均分 @work.teaching_asistant_score = @work.student_works_scores.where(:reviewer_role => 2).average(:score).try(:round, 2).to_f - if @work.teacher_score.nil? - if @work.student_score.nil? - @work.final_score = @work.teaching_asistant_score - else - ta_proportion = @homework.homework_detail_manual.ta_proportion if @homework.homework_detail_manual - ta_proportion = @homework.homework_detail_programing.ta_proportion if @homework.homework_detail_programing - final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{ta_proportion}") - final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{ta_proportion}")) - final_score = final_ta_score + final_s_score - @work.final_score = format("%.2f",final_score.to_f) - end - end when 3 #学生评分 学生评分显示平均分 @work.student_score = @work.student_works_scores.where(:reviewer_role => 3).average(:score).try(:round, 2).to_f - if @work.teacher_score.nil? - if @work.teaching_asistant_score.nil? - @work.final_score = @work.student_score - else - final_ta_score = BigDecimal.new("#{@work.teaching_asistant_score}") * BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}") - final_s_score = BigDecimal.new("#{@work.student_score}") * (BigDecimal.new('1.0') - BigDecimal.new("#{@homework.homework_detail_manual.ta_proportion}")) - final_score = final_ta_score + final_s_score - @work.final_score = format("%.2f",final_score.to_f) - end - end end if @work.save diff --git a/app/views/layouts/base_courses.html.erb b/app/views/layouts/base_courses.html.erb index 4830431a0..800f2ff9d 100644 --- a/app/views/layouts/base_courses.html.erb +++ b/app/views/layouts/base_courses.html.erb @@ -145,12 +145,12 @@
- <%= render_flash_messages %> <%= yield %> - <%= call_hook :view_layouts_base_content %> + <%#= render_flash_messages %> + <%#= call_hook :view_layouts_base_content %>
-
+
diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index d128eab67..a5c7c3486 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -1,5 +1,11 @@ -
- -
- - -
-
-
- -
-
- -
-
-
- - <%= link_to "所有作品(#{@stundet_works.count})".html_safe,student_work_index_path(:homework => @homework.id), :class => "fl"%> - - <% if @show_all%> - - <%= select_tag(:late_penalty,options_for_select(course_group_list(@course),@group), {:class => "fl h22 w100 ml10"}) if(@is_teacher && course_group_list(@course).count > 0) %> - 搜索 - <%= link_to("缺评情况",student_work_absence_penalty_student_work_index_path(:homework => @homework.id), :class => "student_work_search fl", :target => "_blank") if((@is_teacher || User.current.admin?) && @homework.homework_type == 1) %> - <% end%> - <% if @is_teacher%> -
- <% unless @homework.homework_type == 2%> - <% if @homework.student_works.empty?%> - <%= link_to "附件", "javascript:void(0)", class: "down_btn fr zip_download_alert", :onclick => "alert('没有学生提交作业,无法下载附件')" %> - <% else%> - <%= link_to "附件", zipdown_assort_path(obj_class: @homework.class, obj_id: @homework, format: :json), - remote: true, class: "down_btn fr zip_download_alert", :id => "download_homework_attachments" %> - <% end%> -
- 使用 - winzip - 工具进行解压可能会导致 - 下载文件乱码 - ,建议您使用 - winrar - 工具进行解压 -
- <% end%> - <%= link_to("匿评", evaluation_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> - <%= link_to("缺评", absence_penalty_list_student_work_index_path(:homework => @homework.id, :format => 'xls'),:class=>'down_btn fr') if @homework.homework_type == 1%> - <%= link_to l(:label_list), student_work_index_path(:homework => @homework.id,:order => @order, :sort => @b_sort, :name => @name, :format => 'xls'),:class=>'down_btn fr'%> - 导出全部: -
- <% end%> + +
+ +
-
-
- - <% if @is_evaluation%> - -
- <% @stundet_works.each do |student_work|%> - <%= render :partial => "evaluation_work",:locals => {:student_work => student_work}%> -
- <% end%> - <% else %> - <% if @homework.homework_type == 1 || @homework.homework_type == 2%> - +
+
+
+
+
+ + 所有作品 + [共199份] + + +
+ + +
- <% @stundet_works.each do |student_work|%> - <%= render :partial => "evaluation_student_work",:locals => {:student_work => student_work}%> -
- <% end%> - <% else%> -
    - <%= render :partial => 'student_work_title'%> -
+
+ +
+
    +
  • + 作品信息 +
  • +
  • + 教师评分 + +
  • +
  • + 教辅评分 + +
  • +
  • + 系统评分 + +
  • +
  • + 匿评 + +
  • +
  • + 成绩 + +
  • +
+
+ +
+
    +
  • + +
  • +
  • 90
  • +
  • --
  • +
  • --
  • +
  • 100(3) +
  • +
  • 90
  • - <% @stundet_works.each do |student_work|%> - <%= render :partial => "student_work",:locals => {:student_work => student_work}%> -
    - <% end%> - <% end%> - <% end%> -
    -
+ + +
-
-
- <%= link_to(image_tag(url_to_avatar(@homework.user), :width => "42", :height => "42"), user_path(@homework.user), :class => "problem_pic fl") %> -
-

- <%= @homework.name%> -

- <% if @is_teacher%> - <%#= homework_anonymous_comment(@homework)%> - <% else%> - <%= student_anonymous_comment @homework %> - <%= student_new_homework @homework %> - <% end %> -
- -
- <%= @homework.description.html_safe %> + +
+ + + +
+
-
+ - <% if @homework.homework_type == 2 && @homework.homework_detail_programing%> - <% if @is_teacher%> - - - "> - - - - <% @homework.homework_tests.each do |test|%> - "> - - - - <% end%> - -
- 输入 - - 输出 -
- <%=test.input%> - - <%= test.output%> -
-
- <% end%> - -
- 开发语言: -
- <% if @homework.homework_detail_programing.language.to_i == 1%> - C - <% elsif @homework.homework_detail_programing.language.to_i == 2%> - C++ - <% end%> +
+
+
+

请以下同学重新提交作业ppt,只要更新附件,不要删除作否则否则否则评分就丢了

+
+ +
+
+

项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题项目问题个数显示问题

+ [展开] +
+ 截止时间:2015-04-02 +
+
+ + 天 + + 小时 + + 分 + + 秒 +
+

作业提交还剩:

+
- <% end%> - -
- <% unless @homework.attachments.empty?%> - 附件: -
- <%= render :partial => 'student_work/work_attachments', :locals => {:attachments => @homework.attachments} %> -
- <% end%> -
-
- - -
- 截止时间:<%= @homework.end_time%> -
- <% if betweentime(@homework.end_time) < 0 %> - - <%= l(:label_commit_limit)%> - - <% else %> - -
+ + +
-
-
-
-
+ +
+ +
+
+ +
+ -
-
+
+ + +
\ No newline at end of file