diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 5c77ebf2..c60a9959 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -297,7 +297,6 @@ class ShixunsController < ApplicationController # 首页实训导航点击时,type参数 def index - logger.info("##########humen count : #{session[:user_id].count}") @type = params[:type] @status = [["全部状态", 0], ["已发布", 2], ["未发布", 1], ["已关闭", 3]] @diff = ["全部难度", "初级学员", "中级学员", "高级学员", "顶级学员"] diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index f0150ea4..8885353c 100644 --- a/app/controllers/student_work_controller.rb +++ b/app/controllers/student_work_controller.rb @@ -7,7 +7,7 @@ class StudentWorkController < ApplicationController require "base64" helper :attachments helper :files - before_filter :find_homework, :only => [:new, :index, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex, + before_filter :find_homework, :only => [:new, :index, :sonar, :create, :homework_discuss, :homework_setting, :student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :program_test,:program_test_ex, :set_score_rule,:forbidden_anonymous_comment,:delete_work,:new_student_work_project,:student_work_project,:cancel_relate_project, :search_course_students,:work_canrepeat,:change_project,:relate_myshixun,:shixun_work_export,:import_score,:code_review_results] before_filter :find_work, :only => [:edit, :update, :show, :destroy, :add_score, :adjust_score, :add_ultimate_score, :praise_student_work, :retry_work, :revise_attachment, :hide_score_detail, :destroy_score, @@ -15,7 +15,7 @@ class StudentWorkController < ApplicationController before_filter :member_of_course, :only => [:new, :create, :show, :add_score, :praise_student_work, :commit_summary, :view_summary] before_filter :author_of_work, :only => [:edit, :update, :destroy] before_filter :teacher_of_course, :only => [:student_work_absence_penalty, :absence_penalty_list, :evaluation_list, :set_score_rule, :forbidden_anonymous_comment, :adjust_score, :add_ultimate_score] - before_filter :require_login, :only => [:index, :show] + before_filter :require_login, :only => [:index, :sonar, :show] if RUBY_PLATFORM =~ /linux/ require 'roo-xls' @@ -493,7 +493,7 @@ class StudentWorkController < ApplicationController render :json => resultObj end - def index + def _index # REDO:分班信息提前查出来,然后循环中根据匹配去取 @is_teacher = User.current.logged? ? (User.current.allowed_to?(:as_teacher,@course) || User.current.admin?) : false @@ -608,6 +608,12 @@ class StudentWorkController < ApplicationController @page = (params['page'] || 1).to_i @student_work_pages = Paginator.new @student_work_count, @limit, @page @offset ||= @student_work_pages.offset + end + + + def index + _index + @stundet_works = paginateHelper @stundet_works, @limit if @stundet_works.size != 0 @stundet_works = if @homework.homework_type == 1 @@ -630,6 +636,35 @@ class StudentWorkController < ApplicationController end end + + def sonar + _index + logger.debug "@stundet_works #{@stundet_works}" + + person_list = @stundet_works.map do |work| + o = { + name: "#{work.user.show_real_name}", + uid: "#{work.user.user_extensions.student_id}", + downloadUrl: '' + } + attachment = work.attachments.first + if attachment + o[:downloadUrl] = "https://#{Setting.host_name}/"+download_named_attachment_path(attachment.id, attachment.filename) + end + + o + end + + respond_to do |format| + format.json { + render json: { + homeworkId: @homework.id, + personList: person_list + } + } + end + end + # 查重详情页面的调分 def adjust_review_score if params[:score] && params[:challenge_id] @@ -1852,6 +1887,7 @@ class StudentWorkController < ApplicationController end end + private def hsd_committed_work?(user, homework) diff --git a/app/views/student_work/index.html.erb b/app/views/student_work/index.html.erb index 9221db7c..99384dfc 100644 --- a/app/views/student_work/index.html.erb +++ b/app/views/student_work/index.html.erb @@ -15,36 +15,37 @@
- <%= link_to @homework.course.name, course_path(@homework.course),:class => "color-grey-9" %> - > <% if @homework.course_homework_category.present? %> - <%= link_to @homework.course_homework_category.name, homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type, :category => @homework.course_homework_category_id), :class => "color-grey-9" %> - <% else %> - <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type),:class => "color-grey-9" %> - <% end %> + <%= link_to @homework.course.name, course_path(@homework.course), :class => "color-grey-9" %> + > + <% if @homework.course_homework_category.present? %> + <%= link_to @homework.course_homework_category.name, homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type, :category => @homework.course_homework_category_id), :class => "color-grey-9" %> + <% else %> + <%= link_to "#{@homework.homework_type_ch}作业", homework_common_index_path(:course => @homework.course_id, :homework_type => @homework.homework_type), :class => "color-grey-9" %> + <% end %> > #<%= get_hw_index(@homework, @is_teacher, @homework.homework_type) + 1 %>
@@ -71,12 +72,12 @@ 参考答案 <% end %> - <% if @is_teacher && @homework.homework_type == 4 && @homework.homework_group_reviews.size > 0 %> -
<% groups.includes(:members).each do |group| %> > - + <% end %> <% if !@group_teacher %> @@ -241,6 +247,10 @@ <% end %> <% end %> + <% if User.current.admin? %> + 质量检测 + <% end %> +