From e72abe4305ee59c0e183f08b7a6243d40e70a35a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 24 May 2019 09:49:40 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=BF=98=E5=8E=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 1 - 1 file changed, 1 deletion(-) 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 = ["全部难度", "初级学员", "中级学员", "高级学员", "顶级学员"] From 88096c807fe139586478eb3c647bb4357c5b8b93 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 24 May 2019 10:19:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=B4=A8=E9=87=8F?= =?UTF-8?q?=E6=A3=80=E6=B5=8B=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/student_work_controller.rb | 42 ++++++++- app/views/student_work/index.html.erb | 104 ++++++++++++++------- config/routes.rb | 1 + 3 files changed, 108 insertions(+), 39 deletions(-) diff --git a/app/controllers/student_work_controller.rb b/app/controllers/student_work_controller.rb index dd9b1bda..df1fdcd6 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 respond_to do |format| format.js @@ -620,6 +626,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] @@ -1842,6 +1877,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 f48bf0b2..d4352309 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 %>
@@ -72,11 +73,11 @@ <% end %> <% if @is_teacher && @homework.homework_type == 4 && @homework.homework_group_reviews.count > 0 %> -
<% groups.each do |group| %> > - + <% end %> <% if !@group_teacher %> @@ -241,6 +246,10 @@ <% end %> <% end %> + <% if User.current.admin? %> + 质量检测 + <% end %> +